Does Team Build support building web deployment projects?


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.

Comments (6)

  1. Andy says:

    The technology looks fantastic, and exaclty what I have been looking for to deploy web projects… however… I can’t get it working quite right.

    This might take a bit of explaining, but please stick with me. (note, some names and places have been replaced to protect the innocent)

    I have a web project, called WebSite, that project lives at "C:ProjectsTrashWebSite" (IIS maps http://localhost to this folder).

    I also have 2 class libraries, one called WebSite.Library ("C:ProjectsTrashWebSite.Library") and the other is called Company.Library ("C:ProjectsJunkCompany.Library").

    The website references and uses both of these libraries.

    I have a web deployment project called WebSite_Deploy (from http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx) created from WebSite.

    The solution (also called WebSite) lives at "C:ProjectsBuild Solutions"

    My workspace root folder is "C:Projects" and all of my projects and solution are checked into source control.

    I can build the Web Deployment project on my dev machine and all is well the "C:ProjectsTrashWebSite_Deploy<Configuration>" contains a deployable version of my website 😀

    Now, I also have a dedicated build machine (with the teambuild/big build services installed). This build server works correctly and I can build class libraries/windows apps. However, when I come to build my web deployment project the build process fails as the deployment project cannot resolve the project references. The <ItemGroup><ProjectReferences> tags in my Web Deployment project file all look ok and as I said the project builds fine on my dev pc.

    Is there a trick to get the project references to resolve correctly on a dedicated build machine?

    I can post a zip of the scenario if required.

    Many thanks

    Andy

  2. anutthara says:

    Hi Andy,

    I need some more info on your scenario.

    1. Does your solution to build contain the web project as well as the web deployment project?

    2. Is the web deployment project msi installed on your build server also?

    3. Is your solution file edited as appropriate to identify the project files as described in http://blogs.msdn.com/nagarajp/archive/2005/10/18/482491.aspx?

    Please feel free to post your issues in http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=22&SiteID=1 or mail me at anutthar at microsoft dot com

  3. Scott Lee says:

    Anu,

    Thanks for this blog post providing more information on integrating Team Build & the Web Deployment projects.

    BTW, I just saw your comment on Scott Guthrie’s blog… and yes, I am the super active ‘slee’ on the VSTS forums. 🙂 I have lots of questions/suggestions…

  4. anutthara says:

    Hi Scott – I’d love to hear more about your suggestions on the web project build experience. Feel free to contact me on my blog, email or the forums of course 🙂

  5. Jason Camp says:

    It seems that you are suggesting that the build server be on the web server. Does this mean that if you have 3 environments, development, staging and production that there would be 3 build servers…one on each web server?

  6. cnblogs.com says:

    最近在项目中使用TFS做为新的项目和源码管理工具。我们的项目在一个解决方案中包含多个website和class和library,在使用Team Build时竟然发现生成的只有dll,网站竟然没有?! 这个问题把我们的配置人员困惑了好久,不过经过搜索,终于在