C# 如何在安装完成后修复exe启动
我试图在安装完成后启动一个应用程序,但出现了C# 如何在安装完成后修复exe启动,c#,installation,setup-project,badimageformatexception,C#,Installation,Setup Project,Badimageformatexception,我试图在安装完成后启动一个应用程序,但出现了BagImageFormat 我在stackoverflow上尝试了提供的所有解决方案,在不同的网站上也尝试了使用自定义操作和添加安装程序类 [RunInstaller(true)] public class InstallerState:System.Configuration.Install.Installer { public InstallerState() : base() { this.Commi
BagImageFormat
我在stackoverflow上尝试了提供的所有解决方案,在不同的网站上也尝试了使用自定义操作和添加安装程序类
[RunInstaller(true)]
public class InstallerState:System.Configuration.Install.Installer
{
public InstallerState()
: base()
{
this.Committed += new InstallEventHandler(MyInstaller_Committed);
this.Committing += new InstallEventHandler(MyInstaller_Committing);
}
private void MyInstaller_Committed(object sender, InstallEventArgs e)
{
try
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
Process.Start(Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location) + "\\some name.exe");
}
catch
{
// Do nothing...
}
}
// Override the 'Install' method.
public override void Install(IDictionary savedState)
{
base.Install(savedState);
}
// Override the 'Commit' method.
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
// Override the 'Rollback' method.
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
}
事实上,我通过一些方法得到了解决方案,但这不是完美的解决方案
当我在自定义操作中关闭InstallerClass时,将启动exe,但安装仍未完成
一些人也给出了解决这个问题的方法,但我不理解这些