Open Visual Studio Solution file only in VS 2019 - visual-studio

I was using .NET Core API project with 2.2 Framework in VS 2017. Now we have migrated all the .NET Core API Projects to 3.0 Framework.I have both VS 2017 and 2019 installed in my machine. When we click on ".sln" file it gets openend in VS 2017. But i want the .sln file to be openend in VS 2019.
Please let me know the changes required to achieve this.
Thanks

For one, you can delete the solution file and create a new one dotnet new sln.
Assuming you have .NET Core 3.0 sdk installed and active (in case of globa.json being present), it should create you an *.sln file for VS 2019.
Alternatively edit your sln and change the first few lines to
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29512.175
MinimumVisualStudioVersion = 10.0.40219.1
thats the sln header VS 2019.4 (16.4) creates on new solutions

Right-click on the .sln file
From the popup menu click on "Open with" and in the submenu click on "Choose another app"
In the splash window select "Microsoft Visual Studio Version Selector", don't forget to tick the "Always use this app to open .sln files" checkbox, and click "OK".
If prompted to save changes to the "devenv.sln" file, save changes.
In this way, a double click on a .sln should open it with the version of Visual Studio that was used to create it.

Open Visual Studio 2019 and select File-->Open than browse to the solution file that should be ported to VS2019 to open it.
After the solution file was successfully opened in VS2019, chose to Save All.
From now on, your solution file will be opened with VS2019 once you doubleclick solution file in file explorer.
P.S.
Editing solution file manually to update VS version is not recommended because it does not respect possible structural changes of the solution file that may appear between VS versions.

Or,
create a shortcut to the .sln file
right-click the shortcut, choose Properties, General
Opens with, click Change and select Visual Studio 2019
(note - this only changes the shortcut, not the .sln itself, but it's a quick safe fix)

Related

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

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.

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 convert project from VS2012 to VS2013

Funny question but I stacked on it. I opened in VS2013 solution file which uses VS2012, but it still doesn't show me any screen for upgrade solution to VS2013. I mean I can open this project in VS 2013 and it works but solution file still shows that it use VS2012
According to this article some wizard should be shown, but it doesn't
http://msdn.microsoft.com/en-us/library/vstudio/ms185327(v=vs.100).aspx
Found the answer. We need to correct manually the Visual Studio sln file like this
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Open the project using VS2013, then go the the directory that the project is in and change the
extension of the Solution file (*.sln) to something like *.sln_12. Now save the project and a new sln file will be created.
Check this url http://visualstudiomagazine.com/articles/2013/06/12/vs-2013-can-load-vs-2012-and-vs-2010-projects.aspx. It supports round-tripping with older versions of visual studio so it doesn't upgrade solution/project file automatically.

Create Solution Folder in Visual Studio Express 2013

I noticed that when you open a solution in VS 2013 Express which contains solution folders, they load properly and the solutions builds properly. Unlike the express versions of Visual Studio 2010 which showed error messages when the solution loaded.
Here's a screenshot of the AvalonDock solution which is open in Visual Studio 2013 Express:
Since Visual Studio 2013 Express can clearly use solution folders, my question is: How do you (if you can at all) create one?
Whether it is a straightforward way from inside Visual Studio or a "hacky" way (for example) of manipulating the .sln file.
To create a new solution folder in VS2013 Express...
Open your solution file in a text editor. Add the Project line to the top of the file. If you want to add more than one then you'll have to invent some new GUIDs.
Open in VS2013, you can now rename, drag/drop projects into it etc.
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "New Folder", "New Folder", " {765E7B51-3482-4523-AE2F-6299401EDD0B}"
EndProject
.
.
.
Select Solution and press Ctrl+Shift+A. Then create text file. Text file will be placed at new folder "Solution Files",
Then delete text file and rename folder.
=)
Alternatively, the Visual Studio Express 2013 Web fully supports this. If you don't want to mess around with the solution file, you can open the solution using the Web version and add the folder from there.
I don't know why the Web version supports it but not the Desktop

Project needs to be opened by Visual Studio 2008 by default in Windows 8

I have installed visual studio 2008 and 2010 and also vs 2012 on windows 8. Now if I open a vs 2008 project, it asks me to convert it to vs 2010 which I don't want.
In windows 8 I tried "open with" but I can't see vs 2008 in programs, when i go to it's destination and try to open it, it opens up as VS 2010 again.
Update
Problem isn't that i can't open projects with VS 2008, problem is I am not able to force a VS 2008 solution to be opened by VS 2008 (by default).
I can open the project by opening VS 2008 and then use file -> Open
These projects are in SVN Tortoise Repository, on windows 7 they open by VS 2008 by default but now I got windows 8 so each time I open project, it asks me for this,
Sorry for confusion.
Not sure why it's working the way it use to work in Windows 7 but I will look it into it, however I am able to fix the problem by,
I think problem came up because I installed VS 2012 and VS 2010 first and then installed VS 2008 at end.
I am experienced something similar.
Windows 8.1 with VS2008 and VS2013 installed.
Problem:
Right mouse select a VS2008 .sln file in File manager.
Select "Open with..." from the menu
The dialog shows one choice, VS2013.
From the "How do you want to open this file?" dialog, select "More Options"
Scroll down past all the new choices and select "Look for another app on this PC"
Paste in the path to VS2008. Example: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
It runs VS2013 instead.
Also, using "File->Properties" to associate the .sln file with VS2008 did not work as I expected. After setting the file association, I expected the be able to double click on that .sln file and bring up VS2008 but it ran VS2013 instead.
Solution:
After using "File->Properties" to attempt to associate the .sln file with VS2008 something has changed.
Now when I attempt step 2 ("Open with..") I get 2 choices: VS2013 and "Visual Studio Version Selector". Selecting "Version Selector" with "Use the App for all .sln files" checked will cause subsequent .sln files to be opened with the correct Visual Studio.

Resources