Sunday, March 20, 2016

UWP : Building UWP (or Windows) App from command line

How to build a UWP (or Windows App) from Command Line


Related Links –

First Approach: Using MSBuild  [ <path to>msbuild.exe <path to>solution/project file ]

Initial Step: Clean the Project (You can also clean the project before Rebuilding the Project)

Example:  C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319>msbuild.exe "C:\Users\Saurabh\Documents\Visual Studio 2015\Projects\SimplyNote\SimplyNote.sln" /t:Clean /p:Configuration=Release


Clean Succeeds:


Step 1: Navigate to the folder where MSBuild resides (Refer Above links for more info)

Example:  
C:\WINDOWS>cd C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319


Step 2:  Now Build the project using MSBuild

Example:
 C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319>msbuild.exe "C:\Users\Saurabh\Do
cuments\Visual Studio 2015\Projects\SimplyNote\SimplyNote.sln"


Step 3: The Build succeeds.


Step 4: Rebuilding the application (Please Note: It’s better to clean the project before Rebuilding, Refer initials step for the same)

Rebuilding Started:

Example:  C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319>msbuild.exe "C:\Users\Saurabh\Documents\Visual Studio 2015\Projects\SimplyNote\SimplyNote.sln" /t:Rebuild /p:Configuration=Release


Rebuilding Succeeded:


Other Examples:
  •            MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release
  •             MSBuild MyApp.csproj /t:Clean /p:Configuration=Debug;TargetFrameworkVersion=v3.5
  •             C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319>msbuild.exe "C:\Users\Saurabh\Documents\Visual Studio 2015\Projects\SimplyNote\SimplyNote.sln" Configuration="Release"
 Second Approach :Using devenv (requires Visual Studio installed) [ devenv /build Release Solution.sln | devenv /build Debug Solution.sln ]

Step 1: Open the Visual Studio Developer Console/prompt.


Step 2: The Visual Studio Developer console/prompt opens.


Step 3: Use the devenv command to build the Solution(.sln) file. Make sure you give proper path to the solution file.
Example:    C:\Program Files (x86)\Microsoft Visual Studio 14.0>devenv /build Release "C:\Users\Saurabh\Documents\Visual Studio 2015\Projects\SimplyNote\SimplyNote.sln"


Step 4: The Build Succeeds!!


You can download the PDF of above post for easy reference from below (Hosted on Google Drive):

Hope that helps!!

No comments:

Post a Comment

Thanks for your valuable comment