gpt4 book ai didi

c# - 在 VS2010 的 .Net 2.0 项目中使用托管 C++ (.Net 2.0) 时出现问题

转载 作者:太空宇宙 更新时间:2023-11-03 14:16:35 24 4
gpt4 key购买 nike

我有两个项目:

1) 一个用 Visual C++ 2005 编写的项目,目标是 .net Framework 2.0。

2) Visual C# 2010 中的一个项目,它以 .net Framework 2.0 为目标并包含 C++ DLL。

当我构建引用 C++ 程序集的 C# 项目时,出现如下错误:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3258: The primary reference "ScannerWizard" 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(1360,9): warning MSB3258: The primary reference "ScannerWizard" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System, 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(1360,9): warning MSB3258: The primary reference "ScannerWizard" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 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(1360,9): warning MSB3258: The primary reference "ScannerWizard" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Xml, 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(1360,9): warning MSB3258: The primary reference "ScannerWizard" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 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(1360,9): warning MSB3258: The primary reference "ScannerWizard" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Data.SqlXml, 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.

如果我将项目设为 4.0,则不会出现这些错误。显然,我不必将其设为目标 4.0 即可使用 2.0 程序集。

知道如何解决这个问题吗?

最佳答案

C++ 项目使用的是 v100 平台工具集。这使得它依赖于某些库的 4.0 .NET 版本。将工具集更改为 v90 即可解决问题。如果没有 v90 工具集,您可能需要安装它们...

关于c# - 在 VS2010 的 .Net 2.0 项目中使用托管 C++ (.Net 2.0) 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6457541/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com