Sunday, June 05, 2022

How to build using command line from Visual Studio?

Here is how we can build using command line or terminal for Visual Studio using msbuild tool

1. Open Terminal from Visual Studio

2. On the terminal type msbuild to build current project 

msbuild /t:build

3. To clean here is the syntax

msbuild /t:clean

4. To Rebuild 

msbuild /t:rebuild

More examples

Examples:

MSBuild MyApp.sln -t:Rebuild -p:Configuration=Release

MSBuild MyApp.csproj -t:Clean

                             -p:Configuration=Debug;TargetFrameworkVersion=v3.5

For more detailed information, see https://aka.ms/msbuild/docs