Downgrading solution from Visual Studio 2017 RC to Visual Studio 2015 - c#

I have had a project in VS 2015 Update 3 with a lot of code logic behind. I upgraded it to VS 2017 RC successfully. The code implementation went on and on until getting to the point where VS 2017 RC exhibited a lot of issues and instabilities e.g. .Net Core DLL template removed! by installer or Resource file could not be compiled and so forth! I'd like to revert the solution back to VS 2015 to keep working flawlessly but it's impossible easily due to a lot of code implemented in VS 2017 excluding new Roslyn features. Any suggestions how to perform the downgrade?

You will also need to update your *.vcxproj files, to change the toolset referenced there to the one used by the earlier compiler.
What I found useful, is to create a small scratch project (just simple console app) in each version of visual studio, then use beyond compare or similar to contrast the .sln and .vcxproj files from each vs version. This will show you the toolset changes and maybe a few others that you need. For example going from vs 2017 to vs 2019 the toolset changes from 141 to 142.
So the lines
<PlatformToolset>v141</PlatformToolset> are for vs2017
and
<PlatformToolset>v142</PlatformToolset> is for vs2019

It's indeed a manual process and no there are no tools that can automate that.

I had the same problem and i fixed it using this solution:
1) create a solution of whichever project you want (winforms, etc)
2) browse to your project folder and find your .sln file.
3) open it using notepad.
4) copy the first 4 lines as shown
here.
5) find your .sln file for the project you wish to downgrade. for example : foo.sln (its found where your project is).
6) open it with notepad and paste the lines instead of the first 4 lines
7) save and open the sln. it should open it under visual studio 2015
i hope this works for you

Related

Open Visual Studio 2008 Solution in Visual Studio 2013 without Upgrading

In short: I need to open an application originally built in Visual Studio 2008 (version 9) in Visual Studio 2013 without upgrading the project since the overall project architecture must remain the same for when I check it back into source control.
Details: I need to open a Visual Studio solution (.sln) inside Visual Studio 2013. The solution in question was originally developed in Visual Studio 2008, so when I try to open said solution in Visual Studio 2013, I am shown a prompt with the projects within the solution checkmarked, with the message:
These projects are either or supported or need project behavior impacting modifications to open in this version of Visual Studio. Projects no displayed either require no changes or will automatically be modified such that behavior is not impacted. Visual Studio will automatically make functional changes to the following projects in order to open them. You will not be able to open these projects in the version of Visual Studio in which they were originally created.*
My attempt at a fix was to just upgrade the solution and hope for the best. This is successful, but after building and attempting to run the main project, I see the following build error:
The type 'Microsoft.Web.Services3.WebServicesClientProtocol' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. *
I then tried both commenting out the references to this assembly and adding in the missing reference. Okay, so then I rebuilt the solution and attempted to run. Same error, but for a different assembly. Repeat fix, same error for different assembly. This pattern continues and continues, and at this point I realize this is unacceptable anyway, because when I make a change to this solution, I need to check it back into source control. When others open it, they may be opening it in VS2008, and therefore this “upgraded” version is inconsistent with the version the business uses. I need to open the solution originally build in VS2008 in VS 2013 (can't work around this, needs to be VS2013). If it helps, I'm using 64 bit Visual Studio 2013 Ultimate.
Any help or guidance will be greatly appreciated!
As several of the commenters have already helpfully pointed out, this is not possible. Round-tripping (i.e., opening and manipulating project files created by an older version of Visual Studio in a newer version of Visual Studio) was not supported until Visual Studio 11. The only way to open a Visual Studio 2008 project/solution in a later version of Visual Studio will be to convert it.
As far as interoperability with previous versions is concerned, you have two options:
Update the project locally (using the migration wizard provided), make any changes to the project file necessary to get it to build, and then edit the code files. Once you're satisfied with your edits, commit only the modified source files, not the project infrastructure files. Your fellow developers, stuck on VS 2008, won't notice any difference.
Update the project locally (using the migration wizard provided), make any changes to the project file necessary to get it to build, and then rename the project file (e.g., by appending a -vs2013 suffix to it). Commit this to your code repository. You will now have two project files in your root directory, one for each version of Visual Studio that your team works with. From here on, you just open the project file corresponding to the version of VS that you have installed.
I used approach #1 for a good part of last year, where I spent most of my time developing a C++ application in VS 2010 on a desktop machine, but also wanted to work on it on my notebook running VS 2013. Of course, in my case, it took a trivial amount of time for the automatic conversion to upgrade my project file after pulling from source control. I didn't have to do any tweaking thereafter to get the project to build. It sounds like your case is different, so option #2 might be a better choice.

Migrating shared project from VS 2013 to 2015

We have a solution on VS 2013 that contains a shared code project type (https://github.com/firstfloorsoftware/mui).
We made some minor changes in this code and it has being part of our solution for a while.
Now I want to open this project in VS 2015. Although I had a minor problem with the shared project that seems to be fixed: https://github.com/firstfloorsoftware/mui/issues/48
I still cannot get rid of the more than 5000 errors on this project. I can run it successfully, but have no idea the reason for so many errors.
One thing I noticed is VS 2015 uses a standard C# project in the solution explorer instead of a special icon indicating a shared project.
How to reproduce the problem:
1 - Download the Modern UI project from github;
2 - Open it on VS 2015;
3 - Make the fix I mentioned here: https://github.com/firstfloorsoftware/mui/issues/48
4 - Reload the shared project after fixing the project file
5 - Notice the number of errors on the error list.
Any ideas?
Igor.
It seems the issue is related to missing files during VS 2015 setup due to the choices I did during setup.
All I did was creating a new Project and choose Windows 8 template. Then the VS 2015 setup is launch and the missing packages are properly installed.
After doing that, I could open my VS 2013 Project in VS 2015 like a charm.
Igor.

Force project AND solution upgrade from VS2010 to VS2013, not just solution file [duplicate]

Trying to open a VS 2012 solution (SLN file) explicitly in VS 2013 succeeds. Simply double-clicking it in Windows Explorer still opens it in VS 2012 instead.
I've read "Visual Studio 2012 doesn't convert vs2010 solution?" and followed the suggestion to "Save As..." the solution file.
Still it opens in VS 2012 by default.
My question:
How to change a SLN file to force it being opened in Visual Studio 2013?
The .sln file indicates the intended version as one of the early lines - for example:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
or:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
However - it can only make use of this if the default application for .sln files is the "Microsoft Visual Studio Version Selector". It is not uncommon for the default .sln application to be a specific version instead. In windows 8:
you can tell which is the default because it says "keep using":
Note that you can also force the upgrade of a .sln or .proj file by using the commandline, where devenv is the target IDE version:
devenv "MyProject.sln" /upgrade
Example:
"%programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" "D:\Source\MySolution.sln" /upgrade
Note that this does not open Visual Studio. An alternative is to, from within the IDE, select "Save As" for your solution file and overwrite or save the solution under new name.
Read more:
http://msdn.microsoft.com/en-us/library/w15a82ay.aspx
Seems like the OP has a working answer already ... but for me the problem was different. I had a VS 2012 solution (several actually) and wanted to convert them to 2013 (which I understand is a trivial change to the .sln file, but I wanted it done automatically in case there was some secret upgrade logic I was unaware of).
So I thought I would open it in VS2013, it would automatically upgrade as expected, and then I'd be set to double click the solution and see it in VS2013 going forward. But opening in VS2013 was NOT upgrading the solution for me automatically as expected and I could not find an explicit way to force the upgrade after opening the file in VS2013. I could work with the solution, save my changes, and close VS2013, but the .sln would remain unchanged and un-upgraded.
Turns out my problem was in how I was opening the solution ... as a habit I right click files and select "open with" to choose the program I want to use to open a file. I do this frequently. Note I am NOT talking about changing the default "open with" program but just opening a file with a specific program once. So I would right click the .sln file... open with Visual Studio 2013 ... and nothing would upgrade.
Eventually I thought to go into VS2013, then do File > Open and select the .sln file (this is foreign to me since I hardly if ever open anything this way, maybe you are the same way). Anyway that did upgrade the solution file instantly.
After upgrading, lines 2-3 of the .sln file changed from this:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
to this:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
So from my experience, to automatically update a VS2012 .sln to VS2013, you must open VS2013 and select the .sln from the File > Open dialog. Using the explorer shell to force the .sln file to open in VS2013 does not invoke the upgrade logic (apparently).
As a further note, I tested with another solution, and after making changes through Configuration Manager (which obviously "touches" the .sln file) it did upgrade a VS2012 to VS2013, even after having opened it through right-click open with.
I had a solution that had previously been upgraded from 2010 to 2013 successfully but still showed the .sln as associated with 2010.
I tested all the methods given in this thread and the only one that successfully corrected the .sln was to open Visual Studio 2013 alone, then open the solution that still was associated with 2010 in the IDE, then use the [File] > [Save (name).sln as] to overwrite the existing .sln file.
Setting the file assoc of the .sln to be the "Visual Studio version selector" made no change and the solution continued to open in 2010.
The devenv (name).sln /upgrade method made no change to my .sln file.
Hacking the raw text of the .sln file corrupted mine and it would not open at all.
To solve this issue I just changed the following lines of the .sln file:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
into these:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
The comment line is to be changed as it is parsed by the solution loader.
Update:
A better approach is to use the devenv command line as pointed in another reply, which will do it safely for you.
This may work for readers attempting to upgrade a solution file to Visual Studio 2015. (I upgraded a VS 2012 solution.)
Open the solution in VS 2015.
Add a new project to the solution. (I added a test project.)
Remove the project.
Save the solution.
You may want to delete the removed project folder at this time since step 3 did not delete it.
This worked for me when neither zumey’s nor TCC’s answers did.
EDIT
Metro Smurf had a similar, but easier answer than mine for a similar question. His steps were:
Open solution in VS 2015
Right-click solution > Add > New Solution Folder (name does not matter)
Save solution
Delete the newly added solution folder
Save solution

open visual studio 2012 projects in visual studio 2008

Im writing an applcation with C# in visual studio 2012 but i want to open that project in another place in visualstudio 2008. How i can do this? in saving i have to do something? Or in oening in visualstudio 2008?
Since I am stuck with VS 2008 in my home computer, I regularly have to do this.
You can modify your solution file (*.sln) manually. Most of the time you just have to change the first two lines that define the VS version of the solution.
From this link:
You can edit the sln and csproj/vbproj files by hand and try that way, I've used this method with no side effects. In the sln file the first lines for VS2010 will say
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
and for a VS2008 solution:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Also, in a 2010 project file you may find a section like
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
which will need to be modified as
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
With only these 2 types of changes I was able to open the solution & projects with VS 2008.
It's not possible.
Visual Studio generally doesn't support forward compatibility -- that is, opening a newer project in an older version of Visual Studio. It generally supports backward compatibility -- opening an older solution in a newer Visual Studio.
Your only real option here is to retain it as a 2008 solution; even then, when you open it in 2012, it may ask you to convert it to a 2012 solution format, which will make it unusable in 2008.
I have found this while I was Googleing. It may be useful in your case:
Visual Studio Project Converter
Disclaimer: I have not personally tried this program.
I had the same need basically because I wanted to keep the compatibility with .net 3.5.
Although VS2010 and VS2012 support projects running on this FW version, many users are still forced by their companies to use VS2008 or 2010.
I could also develop in 2008 but as a geek that I am I dind't even consider it! :)
So, my solution was to create separate *.sln and *.csproj files for each VS version.
This way you guarantee that everything will work out of the box for each VS version.
The easier and faster way I found to do this was to open eash VS version and create empty solution and projects, with the same structure as the original but with the vs version on the name like:
my.solution.sln
my.project.csproj
...
my.solution.vs2008.sln
my.project.vs2008.csproj
...
my.solution.vs2010.sln
my.project.vs2010.csproj
...
Keep in mind that you have to manually open all the versions and add the new files and so on... they won't be automatically synchronized but it pretty much works.
Hope this helps,
Cheers!

Visual Studio version-agnostic projects/solutions: is it possible?

I remember seeing an open source project within the last year that I was able to open in both VS 2008 and VS 2010 without an upgrade wizard popping up. I think...
Is it possible to create a project/solution that will open up in any version of Visual Studio without prompting me to run the upgrade wizard? If so, how do I do this?
Information for both C++ and C# projects would be most helpful.
You can, use CMake and generate VSx solution.
I think the project that you have seen had 2 visual studio solutions for different visual studio versions.
Update:
Also, you can use http://sourceforge.net/projects/vspc/
or see http://www.emmet-gray.com/Articles/ProjectConverter.htm
The solution format hasn't changed significantly over the visual studio versions except the version number.
If the code itself is generic enough (not using linq, etc) then you can edit the first line of the solution file to "downgrade" the version.
VS2005 uses:
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
You can give the Prebuild project a try to generate needed solution files on the fly.
Prebuild is a cross-platform XML-driven pre-build tool which allows
developers to easily generate project files for major IDE's and .NET
development tools including: Visual Studio .NET 2002, 2003, 2005, 2008, 2010
SharpDevelop, MonoDevelop, NAnt and Autotools.
May be it is not what you ask about, but you can convert you project into nmake target
The only way to do this is to create separate solutions (for 2010 and 2008), and include existing projects to different solutions. Create new projects in VS2008, and then add them to VS2010 solution.
You may need something like round-tripping
Round-tripping is the ability to use a current or previous version of Visual Studio to target a platform that is supported by both versions of VS. For example, with round-tripping, you can open projects from a previous version of VS in a newer IDE without the need for conversion, thus allowing you to work side-by-side on old and upgraded projects.
Read more

Categories