I had been away on a vacation to Goa last week…had such a great time with the water sports – parasailing, water scootering, boating in paddle boats… The weather was pleasantly sunny and the beaches were just perfect for lazing around the whole day doing nothing.
Well, back to business then…The question is “will team build support building web deployment projects?”. You bet we will 🙂
Consider a scenario where you have a web site in your solution and you added a web deployment project to that web site. Suppose you have chosen to deploy your web site on a location called MyWebsiteDeploy in the web deployment project. Also, suppose you chose to merge all your web site dlls into a single dll called MyWebsite.dll.
1. Add a web deployment project to your web projects, you just need to add the web deployment project to source control as you add other projects and check in.
2. In your build type, choose “Mixed Platforms” to build
3. Kick off a build on Team Build with that build type
The web site is pre compiled as usual with the dlls dropped into the _PublishedWebsites\websitename folder. After that, the web deployment project is compiled and the dll MyWebsite.dll is dropped into the _PublishedWebsites\webdeploymentprojectname folder. This is the merged dll belonging to the web site. Deployment is also done on the build machine by creating a virtual directory on the IIS server on the build machine. Now, the web site is deployed in a web site called MyWesiteDeploy on the build machine. You can run web tests on this website deployed on the build machine now.
But before the build is successful, there are a few things that need to be done on your build server:
1. Add the build service account as administrator on the build server and restart the build service (called Team Build service). You need to do this since it is the Team Build process that needs to create a virtual directory on the build server in order to deploy your web site.
2. Explicitly give normal users read permission to the build directory in order to support browsing of the deployed projects. The web deployment project built dlls are stored in the build directory which will have ACLs set on them already. Hence, you need to add the explicit read if you want to browse your web sites on the web server.
Another interesting scenario would be:
1. Open VS
2. Goto File ->New->Website
3. Choose localhost and C# in the drop downs and click OK
4. Add a web deployment project to the web site through right click->add web deployment project
5. From solution explorer, add web site and deployment project to source control
When you launch a build on this team project, build fails. This is because when you open the web deployment .proj file, you can see the web source code location being set to ..\inetpub\wwwroot or whatever the virtual directory has been set to on the client. Since source control puts your web projects in a different folder structure (described in my other blogs), you will need to edit the web source node element’s value to a relative path to the web project source code. This would be ..\WebsiteName for a default solution structure.
I hope that helps all folks trying to use the web deployment addin with the Team Build B3 bits.