The last 2 days I had a lovely time upgrading a major project we work on at BrightMix over to Visual Studio 2008. Actually, the code upgrade was totally automated by VS2008 so that was easy. The hard part was getting VS2008 Team Foundation Build Client to play nice with our Team Foundation 2005 Build Server (abbreviated as TFBS from now on).
Oh, the Trials And Tribulations...
The first thing you find out is TFBS can't figure out how to build 2008 solutions. You'll see something like this in your build log file:
Build FAILED.
C:\Builds\TFSNow\TfsNow-PublicWebsite-Continuous\Sources\PublicWebsite.sln(2): Solution file error MSB5014: File format version is not recognized. MSBuild can only read solution files between versions 7.0 and 9.0, inclusive.
Fortunately, Mitch Denny has a great post detailing out how to fix this issue. Following Mitch's post, I upgraded the build server from .NET 2.0 to 3.5 and replaced the .NET 2.0's MSBuild.exe with a dumby MSBuild.exe that redirects to .NET 3.5's MSbuild.exe. Fun times. For your convience, here's the dumby .NET 3.5 MSBuild executable that I used (note: mine is hardcoded to redirect to C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe - you'll have to compile your own if you need it to go someplace else).
Next Problem: Deploying Web Applications
After I got the dumby MSBuild.exe in place, I fired off a test build and another error showed up in the log:
error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0 \WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
The problem is with an <import> declaration in the Web Application Project's .csproj file. Basically, the "Microsoft.WebApplication.targets" file doesn't exist on the build server because it only has TFS 2005 installed.
I ran across a couple of helpful blog posts for this problem: Steve Harmen demonstrates a fix to the Web Application Project's .csproj file that involves adding another <import> declaration and some conditional logic. So, I added that in and, sure enough, the test build was now successful.
Surprise! Another Problem!
However, I quickly discovered that the Web Application Project's files (.aspx, .html, binaries, etc.) were not getting deployed to the test server's drop location. Some further digging revealed that some other people have had this problem, but no one had come up with a solution.
My Final Solution
What I ended up doing to get this working was leaving the <import> declaration in my Web Application Project's .csproj to point at the VS2008 directory (the one with "v9.0" in it). Then, I simply created that directory on the build server, since it didn't exist, and I copied the v8.0 "Microsoft.WebApplication.targets" file into the newly created "v9.0" directory. This probably isn't the best solution for this problem, but it seems to work.
If anyone has feedback on this, please leave a comment!