C# Visual Studio 2012 项目不会在 2010 年打开
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15405108/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio 2012 project won't open in 2010
提问by user2141272
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?
我在 Visual Studio 2012 和我所在的大学使用 2010 中为作业创建了一个游戏,但它无法打开!它提到了一些关于 NET Framework 4.5 的内容。我如何转换我的项目以便它在 2010 年开放?
回答by Matthew Watson
You may only need to open the project in Visual Studio 2012, and go to the project's properties page.
您可能只需要在 Visual Studio 2012 中打开项目,然后转到项目的属性页面。
On the Application tab, locate the Target Framework setting, and change it to .Net Framework 4.
在应用程序选项卡上,找到目标框架设置,并将其更改为 .Net Framework 4。
After that, you shouldbe able to open it in Visual Studio 2010.
之后,您应该可以在 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.
另请参阅将 VS2012 解决方案转换为 VS2010,但到目前为止我还没有对 VS2012 创建的项目进行任何转换以在 VS2010 中打开它们 - 但 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 couldopen it in VS2010.
我刚刚通过在 VS2012 中创建一个 .Net 4.5 项目再次测试了这个(可以肯定),并验证我无法在 VS2010 中打开它。然后我再次在VS2012中打开,将框架版本改为.Net 4.0。之后我可以在VS2010中打开它。
Note that I didn't have to make anyother 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...
请注意,我不必进行任何其他更改。但是,这是在安装了 VS2010 和 VS2012 的计算机上,因此安装 VS2012 可能会对 VS2010 执行某些操作以使其工作...
回答by Oliver
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.
您可以在 Visual Studio 2010 中创建一个新项目,然后在解决方案资源管理器中右键单击 > 添加 > 现有项目。浏览 2012 年项目中的所有文件。
回答by Oliver
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.
在 VS2010 中创建一个新解决方案并添加 VS2012 中的所有现有文件,或者将 .sln 文件与使用 VS2010 新创建的 .sln 文件进行比较。在顶部,您会看到一些应该更改的版本信息。还要比较 .csproj 文件并相应地更改任何版本信息和目标框架。
回答by Mike Williams
I have done this at work
我在工作中做过这个
Open .sln file with notepad
用记事本打开 .sln 文件
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
嘿,解决方案现在在 VS2010 中打开
回答by vahid
It takes three step:
它需要三个步骤:
Step 1
第1步
Open solution file (.sln) in a text editor and change
在文本编辑器中打开解决方案文件 (.sln) 并更改
Microsoft Visual Studio Solution File, Format Version 12.00
to
到
Microsoft Visual Studio Solution File, Format Version 11.00
Step 2
第2步
Open application configuration file (App.config) in a text editor and change
在文本编辑器中打开应用程序配置文件 (App.config) 并更改
sku=".NETFramework,Version=v4.5"
to
到
sku=".NETFramework,Version=v4.0"
Step 3
第 3 步
Open project file (for C# language .csproj) in a text editor and change
在文本编辑器中打开项目文件(对于 C# 语言 .csproj)并更改
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
to
到
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
Now enjoy your project in VS 2010 !
现在在 VS 2010 中享受您的项目吧!
回答by steamfood
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.
缺少库或框架也可能导致此问题。例如,如果您想打开一个 MVC4 或 Silver Light 项目,但您的 PC 上没有安装这些库。
回答by Munnoo
Open .sln file and Change Format Version to 12.0 to 11.0
打开 .sln 文件并将格式版本更改为 12.0 到 11.0