Best Practices for Deploying ASP.NET Apps with Visual Studio 2010 Web Deployment Projects

Visual Studio 2010 Web Deployment Projects: A Complete Guide

Overview

Visual Studio 2010 Web Deployment Projects (WDP) extend Visual Studio’s web project build and deployment capabilities. WDP provides pre- and post-build actions, supports merging and transforming configuration files, and creates deployable packages or folder outputs that integrate with MSBuild. This guide explains setup, common tasks, configuration options, and best practices for deploying ASP.NET web applications using WDP.

Prerequisites

  • Visual Studio 2010 (with Service Pack updates recommended)
  • Web Deployment Projects extension for VS2010 (install if not present)
  • MSBuild (ships with .NET Framework)
  • Access to target deployment environment (file share, IIS, or remote server)

Installing and enabling Web Deployment Projects

  1. Download and install the Web Deployment Projects extension for Visual Studio 2010 if it’s not already installed.
  2. Restart Visual Studio and open your Web Application Project.
  3. Right-click the web project in Solution Explorer → Add Web Deployment Project.
  4. Name the WDP project (commonly ProjectName.WebDeploy) and click OK.

Project structure and key files

  • The WDP appears as a separate project in the solution (.wdproj file).
  • .wdproj is an MSBuild file — editable directly for customizations.
  • Output folders contain compiled assemblies, merged outputs, and transformed configs ready for deployment.

Build and output options

  • Build configuration: Choose Debug/Release and platform in the WDP properties.
  • Output location: Set folder path for the deployed files (local folder, network share).
  • Merge options: WDP can merge assemblies into a single assembly or leave them separate. Use merging carefully—single assembly simplifies deployment but may complicate debugging and updates.
  • MSBuild integration: You can build the WDP from Visual Studio or run MSBuild on the .wdproj to automate builds on CI servers.

Configuration transformations

  • WDP supports Web.config transformations using config transforms (Web.Debug.config / Web.Release.config).
  • You can apply additional XML transformations in the WDP settings or via custom MSBuild targets to modify settings such as connection strings, appSettings, and compilation settings for the target environment.

Pre- and post-build actions

  • Use the WDP properties to specify commands or scripts to run before or after the build. Common uses:
    • Copying additional files to the output folder
    • Running database migration scripts
    • Zipping the output for distribution
  • Pre/post-build steps can call command-line tools, PowerShell scripts, or MSBuild targets.

Integrating with CI/CD

  • MSBuild-compatible: Use the .wdproj in automated build servers (TeamCity, Jenkins, TFS Build, etc.).
  • Command example:

    Code

    msbuild ProjectName.WebDeploy.wdproj /p:Configuration=Release /t:Build
  • For continuous deployment, produce an output package to a network share or artifact repository, then deploy to IIS using Web Deploy or custom scripts.

Deploying to IIS

  • WDP produces the files needed for deployment to an IIS site (bin, content files, transformed Web.config).
  • For automated IIS deployment, combine WDP output with Microsoft Web Deploy (msdeploy.exe) or copy files to the site folder and perform an IIS reset if needed.
  • Ensure correct file permissions and app pool configuration on target server.

Troubleshooting common issues

  • Missing assemblies at runtime: Verify Copy Local and assembly merge settings; ensure dependent assemblies are included in the output.
  • Web.config transform not applied: Confirm correct build configuration and that transform files exist with the correct naming pattern (Web.Release.config).
  • Path or permission errors when writing output: Use a local folder or ensure network share permissions are set for the build account.
  • MSBuild errors: Inspect the .wdproj for custom targets and validate paths and properties used in scripts.

Best practices

  • Keep WDP .wdproj under source control alongside the web project.
  • Use environment-specific transforms for Web.config and avoid hard-coded secrets in source.
  • Use CI builds to produce reproducible deployment artifacts.
  • Prefer smaller, well-scoped assemblies over excessive merging unless simplifying deployment is critical.
  • Test deployment in a staging environment before production rolling updates.

Example MSBuild command for CI

Code

msbuild Solution.sln /t:Build /p:Configuration=Release msbuild ProjectName.WebDeploy.wdproj /p:Configuration=Release /t:Build /p:OutputPath=\buildserver\artifacts\ProjectName

When to consider alternatives

WDP is valuable for legacy ASP.NET workflows. For newer projects consider:

  • Web Deploy (MSDeploy) for package-based, parameterized deployments.
  • Web Publish (built into later Visual Studio versions) or Azure DevOps pipelines for cloud and modern CI/CD workflows.
  • Containerization for environment consistency and modern deployment patterns.

Summary

Web Deployment Projects for Visual Studio 2010 add powerful pre/post build hooks, MSBuild integration, config transformations, and flexible output control—making them a solid choice for automating and customizing ASP.NET deployment workflows, especially in legacy environments. Use source-controlled .wdproj files, CI builds, and environment-specific transforms to create reliable, repeatable deployments.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *