新的.NET 2.0的C ++ / CLI项目对mscorlib程序V4式的依赖? [英] New .NET 2.0 C++/CLI project has implicit dependency on mscorlib v4?

查看:345
本文介绍了新的.NET 2.0的C ++ / CLI项目对mscorlib程序V4式的依赖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的C ++ / CLI项目在Visual Studio 2012年,随着.NET 2.0选定为项目创建页面上的框架。我已经验证了外部相关性(mscorlib.dll中,System.Data.dll中,System.dll中,并system.xml.dll的)节目路径作为 C:\ WINDOWS \ Microsoft.NET \框架\ V2.0.50727 \ *

I created a new C++/CLI project in Visual Studio 2012, with .NET 2.0 selected as the framework on the project creation page. I have verified the "External Dependencies" (mscorlib.dll, System.Data.dll, System.dll, and System.XML.dll) show "Path" as being c:\Windows\Microsoft.NET\Framework\v2.0.50727\*.

在增加提及这个项目从C#.NET 2.0的项目在同一个解决方案,在构建时,编译器不能对我的C ++联系起来,出现以下错误库:

When adding a reference to this project from a C# .NET 2.0 project in the same solution, at build time the compiler cannot link against my C++ library with the following error:

警告2的主要参考   D:\ GIT \ EasyBCD的\发布\ Win32Interop.dll无法解析   因为它在.NET Framework组件中的间接依赖   mscorlib程序,版本= 4.0.0.0,文化=中立,   公钥= b77a5c561934e089,它具有更高版本4.0.0.0   比在当前目标的版本2.0.0.0   框架。 C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ Microsoft.Common.Targets 1578

Warning 2 The primary reference "D:\GIT\EasyBCD\Release\Win32Interop.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets 1578

不过,就像我说的,在Win32Interop项目的引用清楚地表明V2.0使用和项目文件本身包含< TargetFrameworkVersion> 2.0< / TargetFrameworkVersion> ,因为它应该。

However, like I said, the references in the 'Win32Interop' project clearly indicate v2.0 was used, and the project file itself contains <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> as it should.

为什么的Visual Studio 2012让我如此艰难的时刻?

Why is Visual Studio 2012 giving me such a hard time?

修改

之谜加深。当试图删除所有,然后在C ++ / CLI项目重新添加.NET引用,这是显示:

The mystery deepens. When attempting to remove all and then re-add .NET references in the C++/CLI project, this is what shows:

正如你所看到的,在上面它说:定位:.NET框架2.0和版本一栏表示,我选择的版本2.0.0.0

As you can see, at the top it says "Targeting: .NET Framework 2.0" and the "Version" column indicates that I am selecting version "2.0.0.0".

不过,在单击OK,这就是引用列表如下:

However, upon clicking OK, this is what the references list looks like:

的靶向框架仍然.NETFramework,版本= 2.0,但是每个单独的参考文献指出,版本4.0.0.0正在使用(连同公钥令牌该版本的文件)。

The Targeted framework remains ".NETFramework,Version=v2.0" but the individual references each indicate that version "4.0.0.0" is being used (along with the public key tokens for that version of the file).

然而,属性选择每一参考时对话框绝对维护正在使用的版文件。谁相信?怎么办?

Yet the properties dialog when selecting each reference absolutely maintains that the v2.0 file is being used. Whom to believe? What to do?

推荐答案

看来,创建.NET CLR 2.0项目不支持。下面是Microsoft Connect上的链接:

It appears that creating a .NET 2.0 CLR project is not supported. Here's the link on Microsoft Connect:

<一个href="https://connect.microsoft.com/VisualStudio/feedback/details/780602/compiling-c-clr-dll-in-vs-2012-targeting-net-2-0-introduces-indirect-dependency-on-net-4-0#tabs">https://connect.microsoft.com/VisualStudio/feedback/details/780602/compiling-c-clr-dll-in-vs-2012-targeting-net-2-0-introduces-indirect-dependency-on-net-4-0#tabs

这篇关于新的.NET 2.0的C ++ / CLI项目对mscorlib程序V4式的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆