Using Team Build with VSTO – Made Easier! (Tobi Kral, Aaron Cathcart)

  • Comments 2

On Monday, the VSTO team released a Whitepaper documenting how to get your VSTO customizations building in a Team Build environment. No longer will you need to install Visual Studio on your build machine in order to accommodate building VSTO projects. You can view the Whitepaper here:

How to Build Visual Studio 2010 Office Development Projects with TFS Team Build 2010

As the whitepaper describes, configuring a build machine to build VSTO projects requires installing some prerequisites and making sure certain resources are in place. There's nothing particularly difficult about the steps, but there are enough assemblies and registry keys that have to be added to the build machine that it's pretty easy to miss one or two when doing it manually. (Really, we're speaking from experience on this one.) To streamline the process, we've found it helpful to use some scripts to take care of the nit-picky detail work.

There are two scripts we've been using, one to gather the required resources, and one to copy everything to the appropriate location on the build machine. There are sample scripts linked below, but first we'll quickly run through how the two scripts work.

CreateVSTOPayload.bat: This is the script that gathers the resources, and it needs to be run on a computer that has Visual Studio 2010 Professional (or better) installed. When executed, the script will create a "Payload" directory and copy the assemblies and target files to it.

InstallVSTOPayload.bat: This is the script that, when executed on the build machine,  will install the resources gathered by CreateVSTOPayload. For the script to work, it requires the "Payload" directory created above as well as a couple of registry files (we have registry files published next to this batch script). Since the script is adding things to protected locations, it is necessary to run it from an elevated command prompt.

Sample Scripts
You can find the sample scripts up on Code Gallery here: http://code.msdn.microsoft.com/vstoteambuildscripts

While these scripts have been working for us, please note that it’s possible you’ll need to do a little tweaking.

Note: For the reg files on Code Gallery if you are using a 64-bit build machine you will need to use the Wow6432Node subkey. For example replace all instances of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft with HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.

Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post
  • I found a problem running the scripts - the lines that set the %progfiles% variables have a space at the end.  This means the space gets set in the xcopy paths, and so nothing is copied.  Removing the space appears to make it work fine.  The problem affects both the Create and Install scripts.

  • Also, if you are using the reg files on Code Gallery on a 64-bit machine, you also need to change the program files bits of the path, otherwise your build will not locate the binaries...

Page 1 of 1 (2 items)

Using Team Build with VSTO – Made Easier! (Tobi Kral, Aaron Cathcart)