在Visual Studio 2013上使用CLR将.net框架重新定位为C ++/cli的2.0

问题描述:

我将具有CLR支持的C ++/Cli项目从.net 3.5降级到.net 2.0.我将项目文件编辑为

I am downgrading a C++/Cli project with CLR support from .net 3.5 to .net 2.0.  I edited the project file to

包括:< TargetFrameworkVersion> v2.0</TargetFrameworkVersion>.

include:<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>. 

我还去了Project-> Properties-> C ++,并添加了以下内容:< AdditionalUsingDirectories> $(FrameworkPathOverride)</AdditionalUsingDirectories>

I also went to Project->Properties->C++, and added the following: <AdditionalUsingDirectories>$(FrameworkPathOverride)</AdditionalUsingDirectories>

在项目属性中,我单击公共属性"选项卡,它显示为"Targeting Framework .net Framework,版本= 2.0."我还检查了项目的依赖关系,他们没有使用.net 4.0.

In the project property, I clicked Common Properties tab, it said, "Targeting Framework .net Framework, version =2.0."  I also checked the depencies of the project, they didn't use .net 4.0.

在源代码中,有一行:#using< mscordlib.dll>.我的理解是它应该使用.net 2.0的mscorlib.dll.

In the source code, there is line: #using <mscordlib.dll>.  My understanding is it should use .net 2.0's mscorlib.dll.

但是,在项目的外部依赖关系中,我右键单击了mscorlib.dll,然后选择属性",完整路径"说:

However, In the Project's External Dependencies, I right clicked mscorlib.dll, then select Property, The Full Path said:

c:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ mscorlib.dll.

c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll.

我使用ILDAsm工具检查输出dll的.net版本.清单表明它正在使用.net framework 4.0.

I used ILDAsm tool to check the .net version of the output dll. The manifest indicated it was using .net framework 4.0.


如何更改设置以使用.net 2.0的mscorlib.dll?是否可以在Visual Studio 2013中做到这一点?


How do I change the setting to use .net 2.0's mscorlib.dll?  Is it possible to do it in Visual Studio 2013?

谢谢

乔治

乔治,您好

我建议您重新创建项目并使用2.0版本进行构建.

I would suggest you recreate your project and build with 2.0 version.

在这里,我站在自己的一边.而且您不需要添加对mscorlib.dll的引用 ,因为构建系统会自动引用它.

Here I created on my side. And you don't need to add reference to mscorlib.dll as it is automatically refered by the build system.