我想在按钮点击
上从winform c#执行msbuild.exe命令private void button2_Click(object sender, EventArgs e)
{
// get the reg key
RegistryKey regKey;
regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MSBuild\ToolsVersions\4");
// get the CurrentInstallFolder
string msBuildToolsPath = (string)regKey.GetValue("MSBuildToolsPath");
我已经更新了我的代码,使用下面的代码来执行msbuild它正在工作但是一旦所有执行屏幕关闭,我应该看到屏幕打开
var solutionFile = item.ToString();
var msbuildPath = msBuildToolsPath;
var startInfo = new ProcessStartInfo()
{
CreateNoWindow = true,
Arguments = String.Format("\"{0}\" /nologo", solutionFile),
FileName = Path.Combine(msbuildPath, "msbuild.exe")
};
var proc = Process.Start(startInfo);
proc.WaitForExit();
答案 0 :(得分:1)
System.Diagnostics.Process.Start(@"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe");