112

I have installed both Visual Studio 2013 and Visual Studio 2015. Projects and solutions that were created in VS2013 are opened by VS2013 as I would expect, but I would like to be able to upgrade those files so that they would be opened by VS2015 when double clicked.

How can I upgrade solution files that are in VS2013 format so that the Microsoft Visual Studio Version Selector will open them in VS2015?

Ben Pschierl
  • 1,441
  • 2
  • 12
  • 18
  • 1
    After upgrading you may want to move the files to the 2015 Projects folder. If you use Team Foundation Server 2013 here are the steps for moving the source code: http://stackoverflow.com/questions/39022515/how-do-i-move-tfs-2013-code-to-a-new-local-working-folder-after-upgrading-soluti/39022713#39022713 – DeveloperDan Aug 18 '16 at 17:54
  • Possible duplicate of [Visual Studio 2012 doesn't convert vs2010 solution?](https://stackoverflow.com/questions/12095339/visual-studio-2012-doesnt-convert-vs2010-solution) – 2Toad Oct 28 '17 at 22:19

6 Answers6

169

The simplest solution IMO (also worked for 2012 and 2013) is:

  1. Open the solution file using Visual Studio 2015
  2. Select the solution file in Solution Explorer
  3. Select File / Save MySolution.sln As...
  4. Overwrite the existing solution file.
DeveloperDan
  • 4,626
  • 9
  • 40
  • 65
Matthias Loerke
  • 2,177
  • 1
  • 14
  • 8
  • 2
    You can't batch this solution – Zach Leighton Sep 10 '15 at 18:36
  • 15
    Note that I had to first highlight the solution itself in Solution Explorer before the expected `Save As` menu item showed up in the File menu. – Sam Dec 09 '15 at 22:47
  • 3
    Also make sure, that you really open the solution with Visual Studio 2015. I opened it with VS 2013 by accident and wondered why Save As didn’t change the Visual Studio version. – Tom Jan 23 '16 at 13:22
  • 3
    Also make sure, that you're highlighting the solution, like Sam said - I was on the website project node, not the solution node. – goodeye Jan 31 '16 at 04:16
  • i have got vs2013 pro and vs2015 community .. i tried this answer it doesn't work for me .. when i open the solution file in note it can see it updated the visual studio version like in Zach answer below but when i double click on the solution again it just opens in vs2013 like before. is there anything else i should check? – Laurence Mar 25 '16 at 13:46
  • This is basically the "official" way of doing what the answer below (http://stackoverflow.com/a/31591633/67824) suggests. For now it makes the exact same changes, but there's no guarantee that won't change which is why it's preferable (barring batching needs). – Ohad Schneider Jun 21 '16 at 12:48
  • 2
    File | Save works just fine, and avoids the unnecessary Save As dialog. – Jim Gomes Oct 04 '16 at 20:38
  • Anyone can't find the solution in the Solution Explorer, check [this answer](https://stackoverflow.com/a/9173460/8967612). – 41686d6564 stands w. Palestine Nov 07 '19 at 05:19
41

Change the version in the .sln file

# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0

To match whatever version you have

As of this morning my VS Enterprise is 14.0.23107.0

Example:

# Visual Studio 2015
VisualStudioVersion = 14.0.23107.0

Visual Studio 2015 Update 3 is 14.0.25420.1

pogosama
  • 1,818
  • 1
  • 24
  • 29
Zach Leighton
  • 1,939
  • 14
  • 24
19

Note: This works for VS 2015 and 2017

An alternative to hand-editing the .sln file or re-saving on top of the original .sln file:

  1. Open the solution in Visual Studio
  2. Right click solution > Add > New Solution Folder (name does not matter)
  3. Save solution
  4. Delete the newly added solution folder
  5. Save solution

The solution will now be upgraded.

Metro Smurf
  • 37,266
  • 20
  • 108
  • 140
  • 1
    Fantastic and easy for VS2017. Thanks. That way Visual Studio changes the .sln file instead of me patching it. – Debbie A Oct 30 '18 at 16:52
8

I ran across this looking for the same thing. The accepted answer works, but I noticed some comments about not being batchable. I found an option for batching and I thought I'd share.

You can use the /upgrade option in devenv.com. This means it's batchable. For example, to recurse the current directory upgrading all .sln files (after backing them up), you could do this:

dir -Recurse -path ".\" *.sln | ForEach-object {
    Copy-Item $_.FullName "$($_.DirectoryName)\$($_.Name.Remove($_.Name.Length - $_.Extension.Length)).vs2013$($_.Extension)";
    & "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" /upgrade $_.FullName
}
Peter Ritchie
  • 35,463
  • 9
  • 80
  • 98
  • Nice answer, good to know the IDE can do it from the command line. How fast is it? – Zach Leighton Jun 21 '16 at 01:45
  • Doesn't actually work for migration from VS2013 -> VS2015. When running the /upgrade command, the message "This project/solution does not require migration. It will open without modification." is displayed, and the .SLN file is left unmodified. – Jim Gomes Oct 04 '16 at 20:36
6

I solved the problem by this: Right click on solution, "Retarget solution".(vs2013)

WooodHead
  • 163
  • 2
  • 9
4

The other solutions here didn't work for me. My project was created in Visual Studio 2012, and I am now using Visual Studio 2015, but this should work if you're going from 2013 to 2015. This is how you manually upgrade a project from a earlier version to a newer one:

  1. Open the Developer Command Prompt for VS2015 (to find it: https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx)
  2. Type in devenv SolutionFile | ProjectFile /upgrade and press enter

Where SolutionFile | ProjectFile is the full path with filename of your .sln file.

https://msdn.microsoft.com/en-us/library/w15a82ay.aspx

AzNjoE
  • 733
  • 3
  • 9
  • 18