Visual Studio 2012 doesn't convert vs2010 solu

2019-01-11 08:40发布

I opened my vs2010 solution with vs2012 but it didn't make any conversion as from 2008 to 2010 was happening. So my solution still remains the same as 10 label on it. when I make a new solution of course it has 11 label on it. I haven't got any problem running like that but I am curious. Is there any difference? if yes, how to convert into vs2012 solution?

10条回答
Root(大扎)
2楼-- · 2019-01-11 08:50

This is slightly different, but along the same lines so in case it helps anyone:

I was loading a project where it looked like it was loading and then kept showing all projects as unavailable. No errors were on the migration report. I tried reloading the solution and projects many times, using various methods including suggestions here.

Finally I found a "Resolve Errors" option when right clicking on the solution in the Solution Explorer. VS went through a load process again and it worked; no problems.

I don't know what it did differently that time, but apparently it made a difference.

查看更多
smile是对你的礼貌
3楼-- · 2019-01-11 08:52

I managed to 'convert' the solution file to change the line containing '# Visual Studio 2010' to '# Visual Studio 2012' in the .SLN file.

查看更多
仙女界的扛把子
4楼-- · 2019-01-11 09:07

There are some exceptions, but mostly you'll be able to open the same project and solution files files in both VS2012 and VS2010 SP1.

VS2012 may convert projects when you first open them, but the changes are (except noted in the document linked) backward compatible with VS2010 (ie using conditionals where needed to only apply to either version when loaded) Most project types will be left entirely untouched though.

查看更多
小情绪 Triste *
5楼-- · 2019-01-11 09:08

I came across this question while googling for a solution to a specific problem: MSBuild was failing to execute the Publish target against a VS2012 solution that had started life in VS2010 when called from the command line (specifically through TeamCity):

error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.3\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

MSBuild was looking for the Azure SDK 2.3 targets in the VS10 location (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.3\Microsoft.WindowsAzure.targets). The cause is explained by Sayed Ibrahim Hashimi in a blog post and, as I understood it, boils down to some decisions they made while enabling cross-version compatibility for solution files. The solution was simple: add the VisualStudioVersion property to the MSBuild invocation, something like this:

msbuild.exe MyAwesomeWeb.sln /p:VisualStudioVersion=11.0

Practically speaking, this overrides the following in each csproj file:

<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>

Presumably you could get the same result by editing all of these by hand to replace 10.0 with 11.0 but that might break backwards-compatibility -- I haven't tried it. I also haven't tried an update to VS2013 to see if the problem persists.

So to wrap this up by answering the question: yes, there are some differences before you "convert" (using any of the methods offered by other answerers) and some differences remain afterwards.

查看更多
甜甜的少女心
6楼-- · 2019-01-11 09:10

You can convert a project from VS2010 to VS2012 by doing the following:

  1. Add the 2010 project to your VS2012 solution by right-click on your solution in the Solution Explorer and Select Add --> Existing Project...

  2. The project will appear in the solution and will have (Visual Studio 2010) appended to its name.

  3. Right-click on the added project and select Properties.

  4. In the Configuration Properties --> General pane, change the setting in Platform Toolset field to Visual Studio 2012 (v110)

  5. Repeat for each configuration type, e.g. Release and Debug.

查看更多
时光不老,我们不散
7楼-- · 2019-01-11 09:12

For C++ projects it makes a difference, as the 2012 compiler (VC11) will only be used on projects that are explicitly 2012, not on 2010 projects opened in VS 2012. Some C++11 improvements are available with the VC11 compiler but not with VC10 (see this SO Answer for a summary), including:

  • Range based for-loops
  • New standard library headers (atomic, mutex, thread,...)
  • Smaller standard library container sizes
  • (And more to follow when the Nov 2012 CTP is delivered to VS 2012)

In order to convert from VS 2010 project to VS2012 there is no need to manually edit the solution file or 'Save As' over the existing project. Instead:

If you decline the update when first prompted, you can update the project later by opening the Project menu and choosing Update VC++ projects... [at the top of the menu options]

From MSDN's "How to: Upgrade Visual C++ Projects to Visual Studio 2012"
(This page was linked from @Joachim's MSDN link, but I wanted to have the answer here on SO since a number of other answers suggested manual workarounds instead of this VS 2012 feature)

查看更多
登录 后发表回答