简体   繁体   中英

Visual Studio 2012 project won't open in 2010

I've created a game for an assignment in Visual Studio 2012 and the university I'm at uses 2010 and it won't open! It mentions something about NET Framework 4.5. How can I convert my project so it will open in 2010?

It takes three step:

Step 1

Open solution file (.sln) in a text editor and change

 Microsoft Visual Studio Solution File, Format Version 12.00

to

 Microsoft Visual Studio Solution File, Format Version 11.00

Step 2

Open application configuration file (App.config) in a text editor and change

sku=".NETFramework,Version=v4.5"

to

sku=".NETFramework,Version=v4.0"

Step 3

Open project file (for C# language .csproj) in a text editor and change

<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

to

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

Now enjoy your project in VS 2010 !

You may only need to open the project in Visual Studio 2012, and go to the project's properties page.

On the Application tab, locate the Target Framework setting, and change it to .Net Framework 4.

After that, you should be able to open it in Visual Studio 2010.

Also see Converting VS2012 Solution to VS2010 , but so far I haven't had to do any conversions on VS2012-created projects to open them ins VS2010 - but YMMV.

[EDIT]

I just tested this again (to be sure) by creating a .Net 4.5 project in VS2012, and verified that I couldn't open it in VS2010. Then I opened it in VS2012 again and changed the framework version to .Net 4.0. After that I could open it in VS2010.

Note that I didn't have to make any other changes. However, this is on a computer with VS2010 and VS2012 installed, so it's possible that installing VS2012 might do something with VS2010 to make it work...

I have done this at work

Open .sln file with notepad

Change the two lines below

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012

To

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010

and hey presto the solution now opens in VS2010

You can create a new project in Visual Studio 2010 and then right click in the solution explorer > Add > Existing item. To pull through all of files in your 2012 project.

Either create a new solution in VS2010 and add all existing files from your VS2012 or compare the .sln file to a .sln file freshly created with VS2010. At the top you'll see some version information that should be changed. Also compare the .csproj files and change any version information accordingly and the target framework.

Missing library or framework could also cause this problem. For example, if you want to open a MVC4 or Silver Light project but you don't have these libraries installed at your PC.

打开.sln文件并将格式版本更改为12.0到11.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM