Visual Studio Web Deployment Projects, provide additional functionality to build and deploy Web sites and Web applications in Visual Studio 2008. This Add-In can be downloaded from Microsoft website: Web Deployment Projects
The Visual Studio built-in "Copy Website" and "Publish Website" options are lacking of flexibility. Web Deployment Projects provides additional functionality for example:
- merging assemblies (from context menu)
- the ability to create pluggable configuration files (from context menu)
- exclude files and folders (*.wdproj file in deployment project)
When merging assemblies you can specify to get only 1 result DLL, instead of multiple when using "Publish web site". Second thing is, that you can define a strong name of result DLL file which means, that it will be easier to updates the web site on the webserver - just replacing the DLL, instead of deleting all assemblies with *.compiled XMLs and copying new ones (can be hundreds). So you don't have to carry about the "strange" assemblies file names (with the hash code varying) like: App_Web_0375kxso.dll, etc.
Ability to create pluggable configuration files allows you to specify independent files, that store the contents of a particular configuration section independently, based on solution configurations. That means for example, that the Web.config section will include different database connectionString for Debug and Release, or any other user specified solution configuration.
You can also exclude files and folders that shouldn't be part of the release, e.g: reports, uploaded files, etc.
Finally the *.wdproj configuration file has a MSBuild syntax, so you can specify there whatever you want. Out of the box there are 4 build process sections: BeforeBuild, BeforeMerge, AfterMerge, AfterBuild, where you can specify your tasks.
The detailed description of the Web Deployment Projects can be found HERE.
Find below some of my *.wdproj configuration examples:
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)_svn" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath).svn" />
Exclude directory except specified file:
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)ChartImages." Exclude="$(SourceWebPhysicalPath)ChartImagesplace.holder" />
<Import Project="$(MSBuildExtensionsPath)MicrosoftMicrosoftAjaxAjaxMin.tasks" />
<!-- Create the list of JS files to minimize. Exclude *.min.js files, e.g. jquery-xxx.min.js -->
<JsFilesDevelopment Include="$(OutputPath).js" Exclude="$(OutputPath).min.js" />
<AjaxMin SourceFiles="@(JsFilesDevelopment)" SourceExtensionPattern=".js$" TargetExtension=".js" LocalRenaming="CrunchAll" />