I want to execute msbuild.exe command from winform c# on button click
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");
I have updated my code used following code to execute msbuild it is working but screen closed out once all execute , I should have to see screen open
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();