For the build we are going to add two steps. A Visual Studio Build Step and a Publish Artifacts step. Visual Studio Build step will build the solution and Publish Artifacts step will make the build contents available for download (or deploy via release services).
In visual studio build step you can set the parameters as shown below.
Solution specifies the solution to build. MSBuild arguments specified to package the web site as a single web deployment package.
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)"
- /p:DeployOnBuild=true /p:WebPublishMethod=Package tells the build to create a web deployment package after the build
- /p:PackageAsSingleFile=true tells the build to create the package as a single zip file
- /p:SkipInvalidConfigurations=true tells the build to generate a warning if the build encounters an invalid configuration
- /p:PackageLocation="$(build.stagingDirectory)" tells the build to create the build out put in temporary staging directory. Files in this location will be overridden when next build happens.
- $(build.stagingDirectory) is a Predefined Variable and more information on such variables can be found here.
In Publish Artifacts step, for the Copy Root specify $(build.stagingDirectory), so that the step can find the contents from the temporary build staging location. Contents can be specified and here it is set to copy all zip files. Multiple arguments can be provided for the Contents, and each argument should be in a separate line. Artifact Name can be specified as your preference, and Artifact Type here set to Server. It can be set to a “File share”. Then accessible shared location should be available for the build services.
Once a build is queued with above steps set, it will build successfluy and will make the build artifacts availablae for downloading.
Downloaded output containes the web deployment package.
In the next post, I will explain how to use this build to create a Release Pipeline, using Visual Studio Team Services – Release, to deploy to Azure Web Apps.