用VS2005打开VS2008项目的技巧!
2011-02-22 23:15
381 查看
第一步:
vs 2005 打开 2008 的方案叫错
---------------------------
Microsoft Visual Studio
---------------------------
The selected file is a solution file, but was created by a newer version of this application and cannot be opened.
---------------------------
OK
---------------------------
大意是: 这个方案文件是新版本 vs 创建的, 2005 打不开她.
修改之, 用个文本编辑器打开 sln 文件, 修改头部的两个数字即可:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
改为
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
第二步:
再次用 vs 2005 打开 sln 文件, 这次 sln 不叫错了, 而是工程文件叫错,
叫错证据:
---------------------------
Microsoft Visual Studio
---------------------------
Unable to read the project file 'CSharp Code Header Designer.csproj'.
E:/X/test.csproj(164,11): The imported project "E:/Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
---------------------------
OK Cancel
---------------------------
错误原因: 2005 没有定义宏 MSBuildToolsPath, 改用宏 MSBuildBinPath.
文本编辑器打开 csproj,
定位到:
<Import Project="$(MSBuildToolsPath)/Microsoft.CSharp.targets" />
修改为:
<Import Project="$(MSBuildBinPath)/Microsoft.CSharp.targets" />
再次打开, OK 了, 且慢, 工程文件还有几处需要修改:
Project 节:
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
删除 ToolsVersion="3.5" 改为
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
将
<ProductVersion>9.0.30729</ProductVersion>
改为
<ProductVersion>8.0.50727</ProductVersion>
删除
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
外部引用节删除(这几个 dll 是 2.0 中没有的):
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
好了, 到此 解决方案和工程文件的修改就完毕了,
编译之.
又他妈叫错了, 该死的 using System.Xml.Linq;
在好些代码中自动加入了 linq 名字空间的 using, 找到, 删除之.
编译, ok 了.
vs 2005 打开 2008 的方案叫错
---------------------------
Microsoft Visual Studio
---------------------------
The selected file is a solution file, but was created by a newer version of this application and cannot be opened.
---------------------------
OK
---------------------------
大意是: 这个方案文件是新版本 vs 创建的, 2005 打不开她.
修改之, 用个文本编辑器打开 sln 文件, 修改头部的两个数字即可:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
改为
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
第二步:
再次用 vs 2005 打开 sln 文件, 这次 sln 不叫错了, 而是工程文件叫错,
叫错证据:
---------------------------
Microsoft Visual Studio
---------------------------
Unable to read the project file 'CSharp Code Header Designer.csproj'.
E:/X/test.csproj(164,11): The imported project "E:/Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
---------------------------
OK Cancel
---------------------------
错误原因: 2005 没有定义宏 MSBuildToolsPath, 改用宏 MSBuildBinPath.
文本编辑器打开 csproj,
定位到:
<Import Project="$(MSBuildToolsPath)/Microsoft.CSharp.targets" />
修改为:
<Import Project="$(MSBuildBinPath)/Microsoft.CSharp.targets" />
再次打开, OK 了, 且慢, 工程文件还有几处需要修改:
Project 节:
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
删除 ToolsVersion="3.5" 改为
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
将
<ProductVersion>9.0.30729</ProductVersion>
改为
<ProductVersion>8.0.50727</ProductVersion>
删除
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
外部引用节删除(这几个 dll 是 2.0 中没有的):
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
好了, 到此 解决方案和工程文件的修改就完毕了,
编译之.
又他妈叫错了, 该死的 using System.Xml.Linq;
在好些代码中自动加入了 linq 名字空间的 using, 找到, 删除之.
编译, ok 了.
相关文章推荐
- vs2005打开vs2008项目的技巧
- 以使用vs2005打开vs2008的项目
- VS2010 打开并能编译VS2012项目的解决方法-----(VS2005,vs2008类似处理方法)
- 使 Web Application 项目文件能同时被 VS2005 和 VS2008 打开的方法
- vs2005如何打开vs2008中创建的工程(项目)【转】
- VS2005打开VS2008项目
- 使 Web Application 项目文件能同时被 VS2005 和 VS2008 打开的方法
- 用VS2005 打开VS2008项目
- VS2005打开VS2008项目的2种方法(vs2005怎么打开2008)
- vs2005如何打开vs2008中创建的工程(项目)【转】
- 使 Web Application 项目文件能同时被 VS2005 和 VS2008 打开的方法
- VS2008项目降级到VS2005打开
- VS2005打开VS2008项目的2种方法(转)
- 如何用VS2005打开VS2008版本的解决方案和项目
- vs2005如何打开vs2008中创建的工程(项目)
- 使 Web Application 项目文件能同时被 VS2005 和 VS2008 打开的方法
- 小技巧:使用vs2005和vs2008打开同一项目
- vs2005 打开 vs2008项目
- VS2005打开VS2008项目的2种方法(vs2005怎么打开2008)
- 在vs2008中打开以前在vs2005上做的项目