Visual Studio 无法打开解决方案文件
我有一个 VS 项目(由其他人制作),当我尝试在 Visual Studio 2008 上打开它时,收到以下错误消息:
“所选文件是解决方案文件,但由此应用程序的较新版本创建并且无法打开”
我本以为VS是向后兼容的。我有什么办法可以打开这个吗?
I have a VS project (made by someone else), and when I try to open it on Visual Studio 2008, I get the following error message:
"The selected file is a solution file, but was created by a newer version of this application and cannot be opened"
I would have thought VS was backwards compatible. Is there any way I can open this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以手动编辑 sln 和 csproj/vbproj 文件并尝试这种方法,我已经使用了这种方法,没有副作用。
在 sln 文件中,VS2010 的第一行将显示
,而 VS2008 解决方案的第一行将显示:
另外,在 2010 项目文件中,您可能会找到类似的部分
,需要修改为
仅通过这两种类型的更改,我就能够打开解决方案&使用 VS 2008 进行项目。当然,可能会出现其他差异,但如果您有时间,您可以随时使用尝试/失败方法,直到您管理它为止。
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
and for a VS2008 solution:
Also, in a 2010 project file you may find a section like
which will need to be modified as
With only these 2 types of changes I was able to open the solution & projects with VS 2008. Of course other differences may appear but if you have time you can always use a try/fail method until you manage it.
VS 向后兼容,是的 - 例如,您可以在 VS 2008 中打开 VS 2005 解决方案文件。但它不向前兼容 - 大概该解决方案是由使用 VS 2010 的人创建的。 编辑:根据评论,使用 VS2010 SP1,您可以打开 VS2012 解决方案。我自己还没有验证过这一点。
幸运的是,虽然解决方案文件不兼容,但我相信您应该能够在 VS 2008 中创建一个新的解决方案,并添加使用 2010 创建的现有项目文件,只要它们没有使用过任何特定于 VS2010 的功能(在项目结构中或在代码本身中)。如果代码面向 .NET 4,您可能还需要调整项目文件以将其重新定位到 .NET 3.5。
您可能会看到有关此的警告(未知的工具版本或类似的东西) - 但它可能会很好地工作。我有许多项目,它们具有针对 VS2008 和 VS2010 的单独的解决方案 文件,但使用相同的项目 文件。
VS is backwards compatible, yes - you can open a VS 2005 solution file in VS 2008, for example. It's not forward compatible though - presumably that solution has been created by someone with VS 2010. EDIT: According to comments, with VS2010 SP1, you can open VS2012 solutions. I haven't verified this myself.
Fortunately, although the solution files aren't compatible, I believe you should be able to create a new solution in VS 2008 and add the existing project files created with 2010, so long as they haven't used any VS2010-specific features (either in the project structure or in the code itself). If the code targets .NET 4, you may need to adjust the project file to retarget it to .NET 3.5, too.
You may well see a warning about this (an unknown tools version, or something like that) - but it may very well work. I have a number of projects which have separate solution files for VS2008 and VS2010, but which use the same project files.
解决方案:
步骤一:
转到项目 .保留 sln 文件,然后右键单击它,选择“属性”。取消选中“只读”,如下所示:
步骤 2:
再次转到项目所在的位置。保留.sln文件,然后右键单击它,用记事本打开它,并将文件上的“Microsoft Visual Studio解决方案文件,格式版本12.00”更改为“Microsoft Visual Studio解决方案文件,格式版本11.00”。
Solution:
Step 1:
Go to your project location where the project's . sln file is kept and then Right click on it, choose "Properties". Un check "Read Only" as like given below:
Step 2:
Again Go to the location where the project's . sln file is kept and then Right click on it to open it with notepad and change the "Microsoft Visual Studio Solution File, Format Version 12.00" to "Microsoft Visual Studio Solution File, Format Version 11.00" on the file.