问题描述
我在我的项目中使用了MySQL 5.6.12我想从myproject部署设置.exe安装这个MySQL设置。如何从myproject安装程序安装程序静默安装MySQL。我也希望将myproject路径设置为MySQL安装程序意味着MySQL安装在myproject路径中(C:\
ProgramFIles \ gllob\myproject \\ \\ MySQL \)。
I have used the MySQL 5.6.12 in my project i want to install this MySQL setup from myproject deployment setup .exe. how to install the MySQL from myproject setup installer silently .i also want to set the myproject path to the MySQL installer means MySQL install in myproject path (C:\
ProgramFIles\glob\myproject\MySQL\).
推荐答案
using System;
using WindowsInstaller;
namespace TestApp
{
public class InstallerTest
{
public static void Install()
{
Type type = Type.GetTypeFromProgID("WindowsInstaller.Installer");
Installer installer = (Installer)Activator.CreateInstance(type);
installer.InstallProduct("YourPackage.msi");
}
}
}
更多访问此处
[]
[]
System.Diagnostics.Process.Start("MyInstallationPackage.MSI");
如果您希望调用线程等到安装完成,请注意此调用将返回 System.Diagnostic的实例。过程
。您可以使用方法 System.Diagnostic.Process.WaitForExit
。最好在一个单独的线程中完成。
请参阅:
[],
[],
[],
[]。
If you want the calling thread to wait until installation is complete, pay attention that this call returns the instance of System.Diagnostic.Process
. You can use the method System.Diagnostic.Process.WaitForExit
. It's better to do it in a separate thread.
Please see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx[^],
http://msdn.microsoft.com/en-us/library/fb4aw7b8.aspx[^],
http://msdn.microsoft.com/en-us/library/ty0d8k56.aspx[^].
这篇关于从C#编码运行.MSI安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!