Building C# Solution in Release mode using MSBuild.exe

C#MsbuildReleaseModeSolution

C# Problem Overview


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");

C# Solutions


Solution 1 - C#

MsBuild.exe [Path to your solution(*.sln)] /t:Build /p:Configuration=Release /p:TargetFrameworkVersion=v4.0

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3682000View Question on Stackoverflow
Solution 1 - C#Abdullah SaleemView Answer on Stackoverflow