Quantcast
Channel: Brennan's Blog » msbuild
Viewing all articles
Browse latest Browse all 10

Web Deployment Projects in Visual Studio 2008

$
0
0

The new release for Visual Studio has been out for MSDN subscribers for a couple of weeks now and if you have tried it out you may have discovered that the Web Deployment Projects are only registered to work with Visual Studio 2005 despite interest in having this capability added directly to the IDE. Instead the add-in will be updated and released for Visual Studio 2008. Today as I upgraded a set or projects from .NET 2.0 to .NET 3.5 I found that the Web Deployment project that I have set up for the website was not loaded, however, I am still able to make use of the project even if Visual Studio does not know what to do with it.

I am a big fan of automation and what MSBuild can do for you. There are bits and pieces of MSBuild sprinkled all over .NET projects. Most project files are actually MSBuild scripts that you can use like any other MSBuild script. What I like to do is place an MSBuild script called build.proj in the root folder of a Solution that I use to carry out common tasks such as building and packaging the Solution. One of these tasks has been to run the Build target in the Web Deployment project for a website and then package the contents of the output folder in a zip file. I prefer doing deployments this way instead of using the publishing feature in Visual Studio which seems to take longer most of the time. Using the MSBuild script also allows me to run the build without using Visual Studio, such as when the code is on a server and not on a development machine. Once the zip file is created I can simply upload it to the server, unzip it and place the files in the directory where IIS is configured to serve up the website. For important websites I make sure to keep an older zip file around in case I need to roll back the changes.

Below is my main build.proj script which assumes the website is in a folder named Website and the Web Deployment project is in a folder called Website_deploy. It creates a zip file with three folders: Assemblies, ThirdParty and Website. The Assemblies folder holds the output files from the class library that holds the custom code used by the website while the ThirdParty folder holds the pre-built assemblies referenced by the class library. Finally the Website folder holds the output generated by the Website Deployment project.

To learn more about working with MSBuild, you can read 7 Steps to MSBuild and to learn how to make better use of Web Deployment Projects you can read Post Build Deployments with MSBuild. Finally, to learn how to easily run the MSBuild script in your root Solution folder you can read Running MSBuild from Visual Studio.


Viewing all articles
Browse latest Browse all 10

Trending Articles