MSBUILD : error MSB1008: Only one project can be specified. Switch: Studio

private void GetExeFile(string link)
{
    Process compiler = new Process();
    compiler.StartInfo.FileName = @"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe";
    compiler.StartInfo.Arguments = link + @"‪C:\Users\khan\Documents\Visual Studio 2012\Projects\Calculator\Calculator.sln /t:build /r:System.dll /out:sample.exe stdstr.cs";
    compiler.StartInfo.UseShellExecute = false;
    compiler.StartInfo.RedirectStandardOutput = true;
    compiler.Start();
    txtGetContent.Text = compiler.StandardOutput.ReadToEnd();
    compiler.WaitForExit();
Jon Skeet
people
quotationmark

You need to quote the solution filename because it has spaces in:

compiler.StartInfo.Arguments = link + @"‪""C:\Users\khan\Documents\Visual Studio 2012\Projects\Calculator\Calculator.sln"" /t:build /r:System.dll /out:sample.exe stdstr.cs";

This is just how argument parsing works - it's not really C# specific.

people

See more on this question at Stackoverflow