本文介绍了指定的可执行文件不是有效的Win32应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试以下代码时,出现了以上错误.有人可以帮我解决这个问题吗?
提前谢谢.

While debugging this following code i have got this above error. can anyone help me to solve this?
Thanks in advance.

private static void InstallSoftware()
		{
			if (installoperations.InstallSoftware == false)
				return;

			string[] installationPackages = System.IO.Directory.GetFiles(Application.StartupPath, "*.msi");
			for (int i = 0; i < installationPackages.Length; i++)
			{
				Process myProcess = new Process();
				myProcess.StartInfo.FileName = installationPackages[i];
				myProcess.StartInfo.Arguments = "";
				myProcess.StartInfo.UseShellExecute = false;
				myProcess.Start();
				Process installp = Process.GetProcessById(myProcess.Id);
				if (installp != null)
					installp.WaitForExit();
			}

			MessageBox.Show("Software Installation Completed");
		}

推荐答案


myProcess.StartInfo.FileName = "MSIEXEC.EXE";
myProcess.StartInfo.Arguments = "/i /q \"" + installationPackages[i] + "\"";


这篇关于指定的可执行文件不是有效的Win32应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 18:05