Visual Studio 2012 project won't open in 2010

2019-01-16 12:43发布

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?

7条回答
迷人小祖宗
2楼-- · 2019-01-16 13:29

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...

查看更多
叛逆
3楼-- · 2019-01-16 13:32

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.

查看更多
闹够了就滚
4楼-- · 2019-01-16 13:33

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

查看更多
来,给爷笑一个
5楼-- · 2019-01-16 13:39

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 !

查看更多
做自己的国王
6楼-- · 2019-01-16 13:41

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.

查看更多
疯言疯语
7楼-- · 2019-01-16 13:45

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.

查看更多
登录 后发表回答