Upgrade Visual Studio 2015 solutions to Visual Studio 2017 - visual-studio

How to convert Visual Studio 2015 solution (.sln) to Visual Studio 2017.
In the past, when a solution from a previous version was opened in the newer VS there was a wizard doing the conversion, but it seems it's not the case in with these versions.

Edit the .sln file with a text editor like notepad. Change the first 3 lines to
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
The first line is empty.
When you save the changes, the icon of the .sln file is changed and the solution will be opened by VS 2017 when double-clicked.

I cannot find Retarget Solution.
What I did instead:
Open the solution file using Visual Studio 2017
Select the solution file in Solution Explorer.
Type Ctrl-S
Actually I got the idea from here:
Upgrade Visual Studio 2013 solutions to Visual Studio 2015

open solution(sln) with vs2017
if prompt 'Retarget Project ...' click ok and done!
else in Solution Explorer > right click on solution name
select 'Retarget Solution'
5. select last version sdk and click ok and done!

In my case, I've searched and applied all solutions.
Installed netcore 2.1 x86 x64
Reinstalled VS2017
What was the solution?
There was a global.json next to the solution and it contained an sdk parameter, I changed it to 2.1.413 (the latest as of today 25/10), and it now compiles!!!

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.

How can Visual Studio determine a solution file's version?

Think that I have two solutions: vs2009.sln and vs2010.sln. Both of solution files have the same extension (.sln) but they have different icons. And they are opened in the related version of visual studio. I wonder how does visual studio determine this?
Edit:
Visual studio version selecter is ok but i wonder how can the icon be different even the extensions are same? I used to know that every extension has only one icon in registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Current Version\explorer\Shell Icons
2.Edit: I found the answer finally. If anyone wonders about that, the answer is here http://msdn.microsoft.com/en-us/library/cc144122%28VS.85%29.aspx
Open your .sln file with Notepad or another text editor. Look for Format Version on the first line which correlates with a Visual Studio version. Here's some that I'm familiar with:
Format Version 8.00 is Visual Studio 2003
Format Version 9.00 is Visual Studio 2005
Format Version 10.00 is Visual Studio 2008
Format Version 11.00 is Visual Studio 2010
Format Version 12.00 is Visual Studio 2013
Solution files are text files.
The very first line contains version information.
For example, for a Visual Studio 2010 solution you will find:
Microsoft Visual Studio Solution File, Format Version 11.00
Additionally, when you have several different versions of Visual Studio installed, the .sln file goes through the Visual Studio Version Selector utility that reads this and opens the corresponding version of Visual Studio. Check the .sln file associations.
Try opening the .sln in a notepad
the first line itself says Microsoft Visual Studio Solution File, Format Version 10.00 or 11 or whatever version it is

How to open a Visual Studio 11 project in visual Studio 2010

I downloaded the Visual Studio 11 Beta last night and started work on a new project, only thing is now I can't open the project with Visual Studio 2010, does anyone know away round this or a way to save the project in the Beta to be compatible with "older versions", I have looked and tried but as of yet failed?
Just open the solution in a text editor
in the second line you can find
Microsoft Visual Studio Solution File, Format Version 12.00
change the version to 11.00 and save it.
Try to open the solution and it works.
Update: the original answer was wrong. Unlike the version of Visual Studio, the format version has diverged over time. Check it yourself. The correct version number for VS 2010 solutions is 11.00, not 10.00 as was originally stated above.
I also could not open the VS11 project in VS10 – with error message "The selected file is a solution file, but was created by a newer version of this application and cannot be opened".
It helped to change the version number on the first line of .sln file (replace the "Format Version 12.00" with "Format Version 11.00")
I've seen this a number of times at work recently. You need to install Visual Studio 2010 SP1 to resolve this.

Resources