PRB: 'Can not find the installation for VS SDK' error using MSBuild of TFS to compile Visual Studio Package

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2010
Date: July 2014   Microsoft Visual Studio 2012
      Microsoft Visual Studio 2013

When you build a Visual Studio Package project using the MSBuild tool of Team Foundation Server or Visual Studio Online, you can get the following error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\<version>\VSSDK\Microsoft.VsSDK.Common.targets (line): Can not find the installation for VS SDK.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\<version>\VSSDK\Microsoft.VsSDK.Common.targets (line): The "FindVsSDKInstallation" task failed unexpectedly. System.ArgumentNullException: Value cannot be null. Parameter name: path1 at System.IO.Path.Combine(String path1, String path2)

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\<version>\VSSDK\Microsoft.VsSDK.Common.targets (line): The "FindVsSDKInstallation" task's outputs could not be retrieved from the "IncludesPath" parameter. Value cannot be null. Parameter name: path1

More Information

This problem happens because MSBuild 64-bit is used but the targets and tasks provided by the Visual Studio SDK are 32-bit only.

You can solve this problem with any of these workarounds (both of them force to use MSBuild 32-bit):

Workaround #1

  • In the Configuration Manager of the Visual Studio package project ("Build", "Configuration Manager..." menu), add the "x86" platform and remove the "Any CPU" platform (using the "New..." and "Edit..." actions in the combobox value).
  • In the properties of the Visual Studio package project, "Build" tab, change the Platform target from "Any CPU" to "x86".

Workaround #2

  • In the Team Explorer window, go to "Builds", right-click the build definition that is failing and select "Edit Build Definition...", select the "Process" > "3. Advanced" section, and change the "MSBuild Platform" from "Auto" to "x86".

Go to the 'Visual Studio Extensibility (VSX)' web site for more articles like this (Articles section)