Open visual studio project in its respective version instead of Visual Studio 2017 - visual-studio

Ever since I installed Visual Studio 2017, it now wants to be the one to open all of my projects. Before installing 2017, if I double clicked a VS 2010 .csproj or .sln in Explorer (Windows 10), it would open in VS 2010. But now opening a project for all previous versions opens in 2017. Even if I right-click and choose Open With > Microsoft Visual Studio Version Selector it always chooses 2017. To open it in the correct version of Visual Studio, I have to first open VS and then browse to the project to open. This is a pain when I don't remember which version the project should open with and just want to click it and open it. Can I reset it to open a project in the version of visual studio it belongs with?

I confirmed how this is meant to work with the team. The only requirement is that you set Microsoft Visual Studio Version Selector as the Default App for .SLN files in Windows. That app launches the version of Visual Studio specified in the solution file. If you crack open a .sln file in an editor, you'll see a section that specifies the version of VS that should be used. It'll look something like this:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.25909.2
One thing to keep in mind though is that value will change whenever a different version of Visual Studio writes to the solution file. E.g., if you create a solution in VS 2010, close VS 2010, launch VS 2017, open the same solution, add a project to it (this is what forces VS to make a change to the .sln file), the version in the solution file will then change to VS 2017. I.e., the last version of VS to write to the solution file, will be set as the version to be used when opening it.
If you're finding it's not working as described, we likely have a bug here. Let me know if that's what you think is happening.

Related

Choose specific VSTO-Version when opening TFS-Project

I do have a TFS Project (TFS 2013) and I would like to set up my Visual Studio 2015 to work at that project. I have Visual Studio 2017 and Visual Studio 2015 installed. Now whenever I go to the main page of my Project and click "Open in Visual Studio" (like described here), Visual Studio 2017 opens. I would like to have it open in VSTO 2015. How can I select which version of Visual Studio should open?
The solution file should contain a UTF-8 signature that describes in which version the solution is to be opened. This is what's used for example to show different icons for solution files targeting different Visual Studio versions.
This signature info is also used by the Visual Studio Version Selector when opening a solution. An easy way to fix this is make sure that have the solution local on your dev machine and then right click -> open with and choose the Visual Studio Version Selector. Then pick the correct version of Visual Studio that you want to use.
This will then be honored by your browser when opening a solution since this also uses the Visual Studio Version Selector.

How to set Visual Studio 2015 as the default editor for older projects

Visual Studio 2015 is backwards compatible with 2013. As a result, it doesn't upgrade solution files that you open with 2015 at all.
Now, I recently installed Visual Studio 2013 and whenever I open a solution (.sln) file, it uses the Visual Studio Version selector to pick Visual Studio 2013 instead of 2015.
How can I configure the Visual Studio Version Selector to use the highest valid version instead of the specific version indicated without necessarily modifying the .sln file (discussed here: How to force a Solution file (SLN) to be opened in Visual Studio 2013?). I want to avoid breaking others who might not be using 2015 yet.
Even if you update .sln file to open with VS2015 by default, it will still work with VS2013. MinimumVisualStudioVersion parameter inside .sln will let users with VS2013 to open solution normally.
I prefer to update .sln files as described here.
Open solution you wish to upgrade in VS2015
Select the solution file in Solution Explorer
Select File / Save MySolution.sln As...
Overwrite the existing solution file.
Find your project(.sln file), right click and select "properties".
Under "General" option, click "Change" button behind "Opens with" item.
Select "VS2015" then click OK. Done~

How to open files with differnet application having the same extension

How does Windows determine the application to start when I double-click on an associated file?
I installed Visual Studio 2013 on my PC and converted an existing solution from version 2008 to 2013.
Interesting, when I double click on a solution in 2008 format it opens VS 2008, for a 2013 it opens VS 2013. That's fine but how does Windows know? All solution files have the same extension .sln, so there must be another way to define the opening application in this case.
The following texts from this post should address your concern:
When you double-click on a .sln file, a small program called vslauncher.exe is called with the path to your .sln file as its first argument. The job of vslauncher.exe is to read enough of your .sln file to determine which version of Visual Studio to use to open your file. Since you may have several versions of Visual Studio installed (VS2003, 2005, 2008, Express SKUs, etc.) you probably want to open the solution with the same copy of Visual Studio that you used to create it.
Visual Studio 2008 .sln files typically start with these two lines:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
That said, if your .sln file signature (the first two lines of your file) does match any known release of Visual Studio, it will be opened by that particular VS version.

Are Visual Studio 2008 and Visual Studio 2012 solutions"compatible"?

I edited my project (which was written in school using Visual Studio 2008) at home using Visual Studio 2010 Express. When I got back to school, I couldn't open my solution anymore as Visual Studio 2008 told me that the file was created with a newer version of Visual Studio. I asked my professor for help and he edited something in the assembly information of the solution and voila, I could open, run, edit it again as nothing ever happened.
However, I forgot what he did with the assembly information. Does anyone here know what he could have done? or is this approach not advisable?
At the top of the .sln file there would be a line:
Microsoft Visual Studio Solution File, Format Version 11.00
If you change the version to 10.00, it would correspond to Visual Studio 2008. Use any text editor for this.
The file format has not changed in between these versions (nor has it for Visual Studio 2012).
Edit the .sln file in Notepad and find the version number (11.0) on the first or second line. Change it to 10.0, save the file, and you should be good to go.

Visual Studio 2012 "Invalid license data. Reinstall is required"

I have a newly built Windows 8 VM with VS 2012 Premium running on it, when I try open any sln file I get the following modal pop up error
Visual Studio 2010 Shell
Invalid license data. Reinstall is required.
I can open the sln's if I open up VS and then do project open, this is really annoying, any ideas how I fix it?
*Note I have done a VS repair and it didn't solve it...and I never had any VS RC release on the machine, all new build with s/w downloaded from the MSDN
Cheers
I encountered the same exact error when I created a solution with a full version of Visual Studio 2012 Professional on one machine and then tried to open the solution file with a copy of Visual Studio 2012 Express on a different machine. I got the error when double-clicking the solution file, but not when loading the solution into an already opened instance.
I fixed the error by opening the solution file (.sln) with notepad and changing the line that says Visual Studio 2012 to say Visual Studio Express 2012 for Windows Desktop.
After that, I was able to double-click to open the solution file on the machine that has Express installed.
I'm using VS 2013. I fixed this by right clicking the .sln and setting the Open With parameter to visual studio 2013 and not VS version selector or VS 2010.
I have faced the same problem. When I set the system Date and Time to the current Date and Time, The Problem solved by itself.
It looks like the .sln extension is owned by "Visual Studio 2010 Shell" a minimal version of Visual Studio that ships with products like SQL Server and Office to provide support for add-in development without any other features. Since this is a minimal version, it's unable to load any project type that ships with Visual Studio Express, Professional or above.
The same may happen when you have Visual Studio Express installed next to a full version of Visual Studio.
This may happen when you install an older version of Office or SQL Server after having installed Visual Studio. The old installer will hijack the extension.
To repair this problem:
use the "Open With" option of Windows and select the "Visual Studio Version Selector" as your default action.
Or open the "Default Programs" option in Windows, look up the .sln extension and make sure it uses the "Visual Studio Version Selector" as default:
Or locate Visual Studio 2012 in the Programs and Features window of Windows and chose "Change", the Visual Studio installer will pop up, chose "Repair" to have it repair the file associations and any other problems that may arise by installing Visual Studio versions in reverse order (it may for example mess up the MsBuild directory as well).
Remember that when Visual Studio 2010 was released, it could not yet know what Visual Studio 2012 would change, as such, it's best to install versions of Visual Studio in the order they were released. This may sometimes prove difficult, as other products may install Visual Studio versions without you knowing.

Resources