Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build VS 2015 extension on build server without VS installed?

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.

like image 801
D.R. Avatar asked Mar 16 '16 12:03

D.R.


People also ask

Do I need Visual Studio on a build server?

Microsoft recently responded to a long standing user voice request "Support .NET Builds without requiring Visual Studio on the server" for the requirement for Visual Studio to be installed on a build server to be removed.

Do I need Visual Studio Express to build with Visual Studio?

Remember: The easiest way to build your visual studio solutions is to install Visual Studio on the build server. Even Visual Studio Express is often enough. That said, you can make it work without it. But it it sometimes a lot of work to figure out.

Do I need Visual Studio 2015 to build C++ projects?

There is a " Build Tools " that contains MSBuild, Visual studio is not required. These tools allow you to build C++ libraries and applications targeting Windows desktop. They are the same tools that you find in Visual Studio 2015 in a scriptable standalone installer. Now you only need to download the tools you need to build C++ projects.

How long does it take to install the Visual Studio extensions?

These extensions are not included, but they are likely to be of interest. It doesn't take long to install the extensions. Probably less than a minute. When installation is done you will be prompted to restart Visual Studio.


2 Answers

Microsoft.VSSDK.BuildTools

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

like image 102
weir Avatar answered Sep 29 '22 23:09

weir


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:

  1. Edit the VSIX project .csproj file, and remove 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.
  2. In the VS2015 IDE, open the Nuget Package Manager for the project, and install Microsoft.VSSDK.BuildTools (I used v14.3.25407)
  3. Back in the .csproj file, find the import which the Nuget package added, e.g. <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" .../>
like image 44
ben Avatar answered Sep 30 '22 00:09

ben