BuildMaster Documentation

Creating a Web Deploy Package

  • Last Modified: 2019-07-18

BuildMaster can be used to build, test, and deploy any type of application, even if deploying those applications involve manual steps like handing-off files to other teams or customers for manual deployment. Not only will there be some time savings from automating some of the process, but everyone will have visibility into the status of the deployment.

Web Deploy(msdeploy) is tool developed by Microsoft that "simplifies deployment of Web applications and Web sites to IIS servers" and "enables administrators and delegated users to use IIS Manager to deploy ASP.NET and PHP applications to an IIS server." This is accomplished by creating a Web Deploy Package (either in Visual Studio or with the tool), and then deploying that package directly to the IIS Web Deploy Extension. Visual Studio also uses Web Deploy when doing a "One-Click publish" or "Right-Click Deploy" of web applications.

Although BuildMaster renders the Web Deploy technology largely obsolete (see Build and Deploy a .NET Web Application for for a much simpler approach), there are a lot of reasons that an organization will still use Web Deploy.

  • legacy applications that are infrequently updated use this process, and aren't worth changing
  • there is a "throw it over the wall" culture, and developers simply deliver Web Deploy Packages to operations
  • Web Deploy Packages are used as a means to deliver applications to customers

Fortunately, you can still use BuildMaster to create Web Deploy Packages without having to change these process, and then deliver those packages to people who will deploy them. Instead of deploying your web applications to server, you "deploy" it to stakeholders or customers by sending them and email with a link to the package. You can even use the Manual Operatation to have them notify BuildMaster when the deployment is manually performed.

How to Create a Web Deploy Package

By adding the Build-Project operation in your BuildMaster plan, you can configure it to package up your Web Application project within the solution and publish them as a Web Deploy Package (.zip file)

Sample Plan:

MSBuild::Build-Project <pathToProject>\<web-project>.csproj
    Configuration: Debug,
    Platform: AnyCPU,
    Arguments: /t:Package /p:PackageLocation=<> /p:PackageAsSingleFile=True
    To: <pathToProject>\<web-project>

This plan effectively runs this "msbuild.exe" command

msbuild <web_app.csproj> /t:Package /p:PackageLocation=<> /p:PackageAsSingleFile=True

Including extra files into Web Deploy package

Sometimes you need to add additional files into Web Deploy package which are not part of Web Application project, but should be deployed to a web server along with web application. These can be some resources or content files generated by a build tool or Azure Web Job files in App_Data folder.

Just to give you a sense of the technique described in that article this is how to add Azure Web Job files into App_Data folder of web application package. We assume here that your solution contains two projects: Web Application located in $(SolutionDir)WebApp directory and Azure Web Job project located in $(SolutionDir)WebJob. You should add the following snippet at the very bottom of Web Application .csproj (.vbproj) file:

<Target Name="CustomCollectFiles">
    <_CustomFiles Include="$(SolutionDir)WebJob\bin\$(ConfigurationName)\**\*" />
    <FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)">

If files you would like to include into the package are in the same project and you don’t need to change their archive paths then you could use a simpler approach. Just add the following BeforeBuild target to Web Application’s .csproj or .vbproj:

<Target Name="BeforeBuild">
    <Content Include="some-path\*.*" />
    <Content Include="some-other-path\*.*" />

Next Steps

After the Web Deploy Package is created, you can notify any BuildMaster user or group that the package is created and needs to be deployed. When you use the [Manual Operation] (/docs/buildmaster/reference/operations/buildmaster/manual-operation) in your plan, the execution will be halted until an individual completes the specified task.

    Name: Manually Deploy MyWebApp,
    AssignedTo: OpsTeamA,
    SendEmail: true

Is this documentation incorrect or incomplete? Help us by contributing!

This documentation is licensed under CC-BY-SA-4.0 and stored in GitHub.

Generated from commit ce197caa on master