I no longer work at Microsoft, so please don't bother leaving a comment here or trying to contact me through my MSDN blog.
You can find my new blog at http://www.technologytoolbox.com/blog/jjameson. My new site also provides copies of all posts from my MSDN blog.
Last year I wrote a post about building Microsoft Office SharePoint Server (MOSS) 2007 solutions on a Team Foundation Server (TFS) 2010 build server, which talked about copying various SharePoint assemblies to a "Reference Assemblies" folder and adding a corresponding registry key for MSBuild to locate the assemblies.
It's nice to see that a similar process has already been covered on MSDN for SharePoint 2010:
However, there are few things I noticed about this MSDN article.
First, the path for the registry key on 64-bit systems is incorrect (although you should be able to easily figure out what the correct path is, once you are navigating down through the registry). For the record:
Second, the MSDN article instructs you to copy several Visual Studio SharePoint assemblies to the GAC on the build server:
Copy the SharePoint Tool Assemblies and Files to the GACThe following assemblies must be copied to the GAC of the build system:
Since I chose to install Visual Studio 2010 on my build server (DAZZLER), then I shouldn't have to install any additional Visual Studio assemblies on my build server. Everything should just work. When I looked at the GAC on my SharePoint Server 2010 development VM (FOOBAR5), I didn't see these assemblies, and since FOOBAR5 doesn't have any trouble building SharePoint projects without these assemblies in the GAC, then I didn't expect DAZZLER would have any problems either.
Lastly, as I mentioned in my post last year regarding building MOSS 2007 solutions with TFS 2010, you'll probably want to copy more assemblies than those that are directly referenced in you project -- in order to avoid code analysis warnings, like the following:
CA0060 : The indirectly-referenced assembly 'Microsoft.SharePoint.Client.ServerRuntime, Version=18.104.22.168, Culture=neutral, PublicKeyToken=71e9bce111e9429c' could not be found. This assembly is not required for analysis, however, analysis results could be incomplete. This assembly was referenced by: C:\Program Files\Reference Assemblies\Microsoft\SharePoint v4\Microsoft.SharePoint.dll.
Here are the assemblies that I ended up copying from FOOBAR5 (which has SharePoint Server 2010 installed) to DAZZLER (which does not have SharePoint Server 2010 installed):
In case it's not immediately obvious, "ISAPI" in the above table means:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
...and "GAC_MSIL" indicates the corresponding assembly folder under C:\Windows\assembly\GAC_MSIL. For example:
I may need to copy additional SharePoint assemblies to my build server in the future, but for now, these are sufficient to compile my current solutions without any warnings.
I also recommend you remove extraneous SharePoint assemblies from your build output, as described in one of my later posts.