【发布时间】:2012-12-14 14:51:25
【问题描述】:
我目前在一个项目中使用 Microsoft BCL Async 库 (here),其中包含大量相互依赖的程序集,全部针对 .NET 4 Full Profile 编译,我不得不在每个项目中使用程序集绑定重定向来获取它编译(根据 issue 2 here)。
我现在遇到的问题是我从 C++/CLR DLL 项目中使用这些库之一,它实际上不需要使用异步,但我有以下编译错误:
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5):警告 MSB3268:无法解析主要引用“ImInterface.dll”,因为它有对框架程序集“System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”的间接依赖在当前目标框架中无法解决。 “.NETFramework,版本=v4.0”。要解决此问题,请删除引用“ImInterface.dll”或将您的应用程序重新定位到包含“System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”的框架版本。
我添加了在所有 C# 项目中使用过的相同 app.config 文件,但它似乎在 C++ 项目中没有任何影响。是否必须将其放在特定目录中或执行任何其他步骤才能识别 app.config 文件?
我的 app.config 文件的内容是:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.11.0" newVersion="2.5.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.11.0" newVersion="2.5.11.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
欢迎提出任何建议!
问候, 安东尼
【问题讨论】:
-
你有没有修好这个安东尼?我遇到了类似的错误,尽管我的与 c++ 无关
-
嗨,詹姆斯,很遗憾没有 - 没有人提供任何有用的建议。我已经在圣诞节离开了,所以下周我会再次关注这个,因为它是我们使用的一个重要项目。你的问题具体是什么?一个 C# 项目?我帖子中的 app.config 文件应该对此有所帮助...
-
我的与 C# 和 Windows Phone/8 的可移植类库有关 我在stackoverflow.com/questions/12597797/… 之后不久发现了一个与我的类似的 stackoverflow 问题。尽管错误非常相似,但不幸的是,它似乎与您的问题无关
标签: .net-4.0 visual-studio-2012 c++-cli