Reputation: 21194
Is it possible to build a Visual Studio 2015 extension project on a build server (TeamCity agent) without Visual Studio installed? What kind of SDK do we need to install?
At the moment we receive the following error message:
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Portable\v4.6\Microsoft.Portable.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
So there is definitely some kind of SDK missing.
Upvotes: 5
Views: 1570
Reputation: 1491
Using @weir's answer almost worked - the project built successfully, but it failed to produce a VSIX container at the end. For some reason the Nuget package hadn't added the necessary Import to the .csproj to bring in the VsSDK.targets, so the VSIX targets were missing and never got executed.
Here are the steps which worked for me:
Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
. This will fail on the build server where the VSSDK doesn't exist in the VSToolsPath.<Import Project="..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.targets" .../>
and add another one below it for the VsSDK.targets file (inside the tools directory), <Import Project="..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\tools\vssdk\Microsoft.VsSDK.targets" .../>
Upvotes: 2
Reputation: 21194
It looks like you have to install the Portable Library Tools on the build agent. You can download them from the VS Gallery and install them without having VS on the build agent using the following parameter /buildmachine
.
Upvotes: 1
Reputation: 4761
Contains targets and tools to enable the building of managed VSIX projects without VSSDK MSI installed. Only for VS 2015 and onwards
Additional packages that may be of interest: https://www.nuget.org/profiles/VisualStudioExtensibility
Upvotes: 2