Building C# Solution in Release mode using MSBuild.exe

user3682000 picture user3682000 · Aug 25, 2014 · Viewed 92.6k times · Source

I am able to build a solution using MSBuild.exe, but my issue is I can only manage to get it to build in DEBUG mode. I need to build my solution in Release mode using MSBUILD.

Here is what I've tried

Process msbuild = Process.Start("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MsBuild.exe", solutionfilepath + " /P:Config=Release");

and

Process msbuild = Process.Start("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MsBuild.exe", solutionfilepath + " /P:Configuration=Release");

Answer

Abdullah Saleem picture Abdullah Saleem · Aug 25, 2014
MsBuild.exe [Path to your solution(*.sln)] /t:Build /p:Configuration=Release /p:TargetFrameworkVersion=v4.0