Software Design Blog

Journey of Rinat Abdullin

Building VSTO Solutions Without Visual Studio

Visual Studio Tools for the Office system 3.0 is an enhancement for Visual Studio 2008 that simplifies development and development of add-ins for the Microsoft Visual Studio.

Yet, it does not simplify life of a developer in scenarios where automated integration and deployment is needed and we don’t want to install Visual Studio and Office on our build server.

Let’s make this work.

Build Issues

Initial error message looks like this:

The imported project “C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\ s” was not found. Confirm that the path in the Import declaration is correct, and that the file exists on disk.

Step 1 - Install prerequisites:

  1. Make sure that SDK for Microsoft .NET 3.5 is installed on the machine.
  2. Install VSTO Runtime 3.0

Step 2 - Copy tasks and targets for MSBuild:

  1. Copy these files from your development machine (where you can build VSTO projects) to the corresponding location on your build machine:

    Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\
  2. Copy libraries from your development machine to the build machine and install it into GAC there:


Now the build should display Interop error like this (or something related to the missing Extensions namespace):

warning MSB3245: Could not resolve this reference. Could not locate the assembly “Microsoft.Office.Interop.Excel, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

Step 3 - Copy Microsoft Office Primary Interop Assemblies (PIA) and VSTO reference assemblies from your machine:

Program Files\Microsoft Visual Studio 9.0\
  \Visual Studio Tools for Office\PIA\Office12

Program Files\Reference Assemblies\Microsoft\VSTO\v9.0

to the references path:

Program Files\Reference Assemblies\Microsoft\Framework\v3.5

Automated build should pass now.

ClickOnce Issues

If you have automated ClickOnce deployment, then this error might pop-up while running the publish target:

error MSB3147: Could not find required file ‘setup.bin’ in ‘ProjectFolder\Engine’

Step 1 - Copy the bootstrapper files from Visual Studio SDK to a similar directory on build machine:

Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper

Step 2 - Create a registry setting to point to the location (ClickOnce MSBuild tasks need that):

Key:  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\GenericBootstrapper\3.5\
Value: Path
  Type: REG_SZ
  Data: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\

Automated ClickOnce publication should pass now.

Step 3 - Fix possible VSTO runtime deployment issue that causes Office customization to fail (VSTO detection logic is messed up). Fix is based on this article.

On the build machine locate the file:


Replace the registry check (that’s the one that does not get updated properly):

  Key="HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v9.0.21022"

with the installation check:


Then alter the element (Value):


to be:


Now every office customization built on this fixed build machine will be able to deploy properly.

Friendly Names

By default, VSTO does not embed friendly product name, description or support URL into the Click Once deployment.

Here’s a quick solution that is based on excellent article by Saurabh Bhatia.

Step 1 - Apply changes in this diff file to your Office2007.targets file (if diff files are unfamiliar to you - simply check out TortoiseMerge page).

Step 2 - Add following properties to the PropertyGroup of your Office Add-in:


Our .NET VSTO add-in for Microsoft Office should have a more friendly look by now.

Did this article help you out?