Sunday 3 January 2016

Part 1 Build ASP.Net 4 Web Site - Deploying to Azure Web Site with Visual Studio Team Services Release

Visual Studio Team Services now has Release Managment Services available as public preview. As the fiirst step let’s create a simple ASP.Net 4 MVC web site and build it with Visual Studio Team Services builds.image
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).image
In visual studio build step you can set the parameters as shown below. image
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.
For Platform and Configuration, variables can be defined in the Variables tab as shown below and can be used in the Visual Studio Build step. image
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.image
Once a build is queued with above steps set, it will build successfluy and will make the build artifacts availablae for downloading. image
image
Downloaded output containes the web deployment package. image
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.

2 comments:

Unknown said...

Wow, what an informative post. Really helpful for web designers. Here described in a good way so that It is easy to read and understand. Visual Studio Team Services now has Release Management Services available as public preview. Thanks a lot for sharing with us.I had some idea about asp.net when I hosted my business through Myasp.net.

Anonymous said...

Thanks it helped

Popular Posts