今天某童鞋想打开老师给的一个VS2010的工程,而其电脑上却没有装VS2010,只装了VS2008,
我让其将工程发给我,我的机子也只装了VS2008,打开工程时提示如下:
选择的文件是解决方案文件,但是用此应用程序的较新版本创建的,无法打开。//截图如下
看后,我突发灵感,将该工程的解决方案文件的后缀由xxx.sln改成了xxx.txt然后,查看其内容如下:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kjcyzgks", "kjcyzgks\kjcyzgks.csproj", "{F722BD49-0B2F-4D05-B735-204A4773453F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F722BD49-0B2F-4D05-B735-204A4773453F}.Debug|x86.ActiveCfg = Debug|x86
{F722BD49-0B2F-4D05-B735-204A4773453F}.Debug|x86.Build.0 = Debug|x86
{F722BD49-0B2F-4D05-B735-204A4773453F}.Release|x86.ActiveCfg = Release|x86
{F722BD49-0B2F-4D05-B735-204A4773453F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
很明显在上面我们看到了# Visual Studio 2010,于是我赶紧将其该成了# Visual Studio 2008,再次打开工程时,
发现还是打不开,想了下,我将自己的VS2008工程的YYY.sln改成YYY.txt,然后看其内容如下:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SSLauncher", "SSLauncher\SSLauncher.vcproj", "{D88F5B39-BE0D-44BC-9C7C-778AE33731C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D88F5B39-BE0D-44BC-9C7C-778AE33731C9}.Debug|Win32.ActiveCfg = Debug|Win32
{D88F5B39-BE0D-44BC-9C7C-778AE33731C9}.Debug|Win32.Build.0 = Debug|Win32
{D88F5B39-BE0D-44BC-9C7C-778AE33731C9}.Release|Win32.ActiveCfg = Release|Win32
{D88F5B39-BE0D-44BC-9C7C-778AE33731C9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
对比一下VS2010的工程,
VS2010的前两行为:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
VS2008的前两行为:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
很明显了,刚才我们只改了第二行,第一行没改,所以打不开,
现在我们将VS2010工程xxx.txt的前两行改为VS2008工程的YYY.txt前两行即可。
最后将xxx.txt 改回xxx.sln,在用VS2008打开xxx.sln,已经可以打开了哦。
//友情提醒
如果你用VS2008打开VS2010的工程,发现编译通过,却运行不了时,
在 生成 里 重新生成解决方案