MSBuild: How to build web deploy package for Web Deployment Projects (VS2010)?

Roman Podlinov picture Roman Podlinov · Mar 18, 2011 · Viewed 18.3k times · Source

I migrated a Web Site project (with Web Deployment project) from VS2008 to VS2010. Now I can make "Build Deployment Package" for Web Deployment Project in VS2010 and it works great! But I can't find a way how to do the same via MSBuild.

Answer

Roman Podlinov picture Roman Podlinov · Mar 22, 2011

I answer on my one question. So after a lot of googling and 2 days of investigation it finally works.

Brief how to:

  1. I created Configuration = QA (based on Debug configuration) for Solution via Configuration Manager.

  2. Important: I removed 'Platform' parameter for QA Configuration. I couldn't build package until I did it. (My dev computer is Win7-x64, and I'm not not sure would be this step necessary for x86. But my build server Win2008-x86 forks fine with this modification.) This is QA Configuration section from my .wdproj

    <PropertyGroup Condition=" '$(Configuration)' == 'QA' ">
    <DebugSymbols>True</DebugSymbols>
    <OutputPath>QA\</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>
    </SingleAssemblyName>
    <UseWebConfigReplacement>false</UseWebConfigReplacement>
    <DeleteAppDataFolder>true</DeleteAppDataFolder>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <ExcludeApp_Data>true</ExcludeApp_Data>
    </PropertyGroup>
    
  3. I build and package .wbproj file with the following command:

    msbuild WebSite.Deploy.wdproj /t:Build;Package /p:Configuration=QA
    

For information: If you need you can use standard Web Publishing parameters (e.g. ExcludeApp_Data, DeployIisAppPath etc.) in the QA configuration section.