Develop VSIX for VS2010 under VS2012? - visual-studio-2010

Is there a way to develop a VSIX extension under Visual Studio 2012, which then could be installed in Visual Studio 2010? I've tried to set version range for Microsoft.VisualStudio.Pro target to [10.0,11.0], but when I launch a compiled VSIX, it offers only VS2012 to be install into.
I know it is possible to develop VSIX under VS2010, which is applicable for VS2012, though it requires to manually edit a .vsixmanifest file. But I wonder if it is possible to use newer VS2012 for developing?

You can, but have to create manually the source.extension.vsixmanifest file in the 1.0 format (handled by VS2010), whereas VS2012 uses version 2.0. You will only lose the visual property editor.
You also need to make sure that you've compiled against .NET 4.0 or lower rather than .NET 4.5.

Related

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....
VS 2010 uses .net 4.0.
I drop the compiler to .net 4.0
The VS 2015 (4.5) assemblies wont load (i.e. Microsoft.VisualStudio.Shell.14.0).
Thats OK as I don't use anything in them, so I drop the references to them in favour of the version 10.0 (2010) ones.
Great the code compiles.
But the VSIX package does not
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).
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.
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)
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....

VSIX visual studio 2010 compatible

I am trying to extend some functionality using VSIX.
When I double click on the VSIX installer it, the following screen pops up. Visual studio 2013 is the only option it provides. But we use Visual studio 2010 for our development.
Can something suggest how to modify the manifest file and steps to make this VSIX 2010 compatible?
Thank you
No, you will most likely have to get the source code of the existing extension, and then build a new one for vs 2010 using the 2010 sdk
As ErikEJ already said, you need to use VSIX Manifest Version 1.
I did it using the instructions here. There is documentation of VSIX Manifest Version 1 here.
You must target Framework Version 4, but there is no need to build with Visual Studio 2010.

Visual Studio 2010 is unable to open project

I used Visual Studio 2010 to develop a web application. I formatted my machine and installed Visual Studio 2010 Professional. When I try to open old projects, I get an error saying:
The selected file is a solution file, but was created by a newer version of this application and cannot be opened.
I do not remember the version of visual studio 2010 I used the first time.
Can anyone tell me which version came after the professional edition?
Make sure VS2010 is updated to the latest service pack, otherwise check to see if the project was actually made in VS2012/13 in which case you will need to create a new VS2010 solution and rebuild it from your existing projects.
Open the .sln file in a text editor. In the beginning there is a marker which tells the VS version it is meant for. For VS 2010 it should look like that:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
You should be able to change these values without any problems. As far as I know the file format did not change.
EDIT
Considering the comment of Dumisani: of course you need to target .net 4.0 and make sure no features of .net 4.5 are used!
Chances are you had a service pack installed that you are missing with a clean installation.

How to choose Visual Studio solution Platform Toolset for maximum compatibility

Background
I am open sourcing a few old Visual Studio applications I created a while back. I have created new solutions using my new VS2012 environment for them and have gotten the projects set up as git repositories. I got everything working fine in Visual Studio 2012 with no changes to the source code, all I needed to do was make sure I was linking the proper libraries in the new project configurations.
I would like to configure these projects as to have maximum compatibility for others downloading the project from Github. On this machine I have VS2010 installed alongside the latest VS2012 version. After I got everything working right for both of the projects in VS2012, I tried to open them up in VS2010.
When I tried to build I got a single error:
Specified platform toolset (v110) is not installed or invalid.
Please make sure that a supported PlatformToolset value is selected.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets 518
What I Tried
So I opened up the properties for the project, went to Configuration Options --> General and the Platform Toolset was indeed set to Visual Studio 2012 (v110). This input is a drop down box and the v110 value is not listed, instead I get two choices:
v100
v90
These correspond to VS2010 and VS2008 respectively. If I change the value to v100 and rebuild I get no errors and my program runs just fine in my Visual Studio 2010 environment.
When I open the project back up in Visual Studio 2012, if tells me that I have an old project file and asks if I want to upgrade, I say yes and it upgrades. I rebuild and run to make sure everything is still working. When I open the configuration options in VS2012 the Platform Toolset is set back to `Visual Studio 2012 (v110) but clicking the drop down input there are several more choices listed:
Visual Studio 2012 (v110)
v110_wp80
Visual Studio 2012 - Windows XP (v110_xp)
Visual Studio 2010 (v100)
Visual Studio 2008 (v90)
‹inherit from parent or project defaults›
My Questions
This has led me to several questions. I am going to pose them all. It would be nice to get as much information as I can, but a good answer to just one of them would probably solve my problem.
If I'm not using features specific to newer versions of Visual Studio, is it possible to set up a solution which can be opened and run without modification in as many versions as possible (ie. 2008, 2010, or 2012)? If so, how?
If I set the Platform Toolset to v90 (VS2008) from within Visual Studio 2012, and it's able to build and run, does this mean that it will build and run for users with VS2012, VS2010, and VS2008?
What exactly does the <inherit for parent or project defaults> option do? What would the project defaults be set up as? Can this be used to tell Visual Studio to try to using whichever installed Platform Toolset will work.
Are there any other options besides Platform Toolset in Visual Studio that I can set to increase compatibility with others' development environments?
This is a somewhat tricky situation. One of the underlying problems here is that VS2010 and VS2012 use MSBuild to build C++ projects, but VS2008 farmed it out to VCBuild instead. You can see this by comparing the project files. VS2010/VS2012 use .vcxproj, while VS2008 uses .vcproj.
If I'm not using features specific to newer versions of Visual Studio,
is it possible to set up a solution which can be opened and run
without modification in as many versions as possible (ie. 2008, 2010,
or 2012)? If so, how?
For maximum compatibility, you want to target the lowest common denominator (i.e. vc90 in this case). Note that when you do the upgrade, the solution file and project files get upgraded to the latest version, which may break compatibility with older versions of Visual Studio.
If I set the Platform Toolset to v90 (VS2008) from within Visual
Studio 2012, and it's able to build and run, does this mean that it
will build and run for users with VS2012, VS2010, and VS2008?
Not really, due to the .vcxproj / .vcproj conflict stated above.
For example, I currently have a set of .vcxproj files and a solution designed for VS2010. I use VS2012 as my IDE, so when I open the VS2010 solution in VS2012, I choose to NOT upgrade it and simply open it as is. VS2012 and beyond should be backwards compatible back to VS2010 as far as project files go.
For maximum compatibility in development environments, my recommendation would be use VS2010's solution as the baseline, targeting v100. Developers can use any version newer than that and it should all work together gracefully.

Use newer Visual Studio Version with an older MFC Version?

From my understanding Visual Studio 2005 always uses MFC8 automaticly, VS2008 MFC9 and VS2010 the MFC10.
Can use a newer Visual Studio Version and still link to an older MFC Version?
I searched the options and the project settings all over but I could not find any option about the MFC.
VS2010 apparently (I don't have it, so I haven't tried it) has the ability to use both VS2008 and VS2010 toolsets to build the applications, provided they are both installed in the machine.
More here
I would expect Visual Studio 11 to have the same ability, but who knows...

Resources