神刀安全网

Compile/Build The UWP Project From The Command Line

There may be situations where building the project from the command line becomes inevitable. I was put into a similar situation where I had to setup a continuous integration for Windows Projects. At this point of time I had to explore how to build the projects from the command line so that I could write the required scripts for continuous integration of Windows Projects using tools like Jenkins, etc.

I will also be posting an article on how to automate the building process or achieve continuous integration for a UWP (or any windows App) using Jenkins in near future. But the perquisite is to understand how to build applications from the command line. So let’s get started.

We have two approaches to achieve what is mentioned in the title:

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

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

Example:


Compile/Build The UWP Project From The Command Line

Step 2:Now Build the project using MSBuild,

Example:


C:/WINDOWS/Microsoft.NET/Framework64/v4.0.30319>msbuild.exe "C:/Users/Saurabh/Do

Compile/Build The UWP Project From The Command Line

Step 3:The Build succeeds.

Compile/Build The UWP Project From The Command Line

Other Examples:

  1. MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release
  2. MSBuild MyApp.csproj /t:Clea /p:Configuration=Debug;TargetFrameworkVersion=v3.5

  3. 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.

Compile/Build The UWP Project From The Command Line

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

Compile/Build The UWP Project From The Command Line

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"

Compile/Build The UWP Project From The Command Line

Step 4:The Build Succeeds.

Compile/Build The UWP Project From The Command Line

All the above screenshots are present in the attachment zip that you can download.

Read more articles on Universal Windows Platform :

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Compile/Build The UWP Project From The Command Line

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮