Sprotty
Sprotty

Reputation: 6003

How do I build a Visual Studio Extension (VSIX) that targets Visual Studio 2010-2017

Our build environment is VS 2015 (ideally) targeting .net 4.0

We have just re-worked our visual studio plugins based on the Visual Studio extensibility project template in VS 2015. The resulting VSIX works great on VS 2015 & 2017 RC1.

However I would like to target the VSIX at VS 2010 (and ideally 2012). This is where the problems start....

1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3274: The primary reference "Microsoft.VisualStudio.Imaging, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

So the problem seems to be that if I target VS 2010 I need it to build as .net 4.0, but the VS 2015 build script requires .net 4.5.

I'm wondering if its possible to use the VS 2010 build tools in a VS 2015 project? Or must I convert my VS 2015 project back to VS 2010?

UPDATE

Starting to think this is not possible for other reasons...

https://learn.microsoft.com/en-us/visualstudio/extensibility/faq-2017

The new VSIX v3 format is backward compatible with VSIX v2, so you’ll still be able to have a single VSIX with a single VSIX ID that supports Visual Studio 2012 and later. The new VSIX v3 format does not support Visual 2010 and earlier. To support Visual Studio 2010 onward, you will need to create a separate extension (with a separate VSIX ID).

Upvotes: 2

Views: 1407

Answers (3)

ErikEJ
ErikEJ

Reputation: 41819

Create a seperate project and VSIX for VS 2010 and another for VS 2012 and later. You can have a look at my source here: https://github.com/ErikEJ/SqlCeToolbox

Notice that I require .NET 4.5.1 for my VS 2010 extension also (simply requires that .NET 4.5.1 is present/installed on the PC, and it is built in to Windows 8.1 and later)

Upvotes: 2

Sprotty
Sprotty

Reputation: 6003

In the end I ended up with 2 projects

  • A project targeting VS 2010 compiled under .Net 4.0 using a version 2.0 manifest (built using VS 2015).
  • A project targeting VS 2012 + compiled under .Net 4.5 using a version 3.0 manifest (built using VS 2015).

There has been a certain amount of faffing around with references, but it all seems to work. Our only outstanding issue is the code signing, as VS 2015 will not accept anything below SHA256 and VS 2012 will not accept SHA256....

Upvotes: 0

Péter Major
Péter Major

Reputation: 188

I have ran into similar problem, so I have created a Nuget package called VsixUpdater, which can do the VSIX migration automatically if added to a VSIX project, it even works with older versions of Visual Studio (I tested it with 2012), after adding the package the generated VSIX packages will be V3 and 2017 compatible, see https://github.com/axodox/VsixUpdater for details.

Upvotes: 2

Related Questions