类型“System.Windows.Input.ICommand"存在于“PresentationCore.dll"和“System.dll"中 [英] The type 'System.Windows.Input.ICommand' exists in both 'PresentationCore.dll' and 'System.dll'

查看:34
本文介绍了类型“System.Windows.Input.ICommand"存在于“PresentationCore.dll"和“System.dll"中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个我无法弄清楚的错误.

I've got this error that I just can't figure out.

我在带有 .net4.5 的 Windows 8 上使用 VS 2012 (VS11),在编译使用 VS 2010 和 .net4.0 的项目时出现此错误.

I'm using VS 2012 (VS11) on Windows 8 with .net4.5 and I get this error when compiling a project that worked with VS 2010 and .net4.0.

这是完整的错误:

类型 System.Windows.Input.ICommand 存在于 'c:Program文件 (x86)参考AssembliesMicrosoftFramework.NETFrameworkv4.0PresentationCore.dll'和'c:WindowsMicrosoft.NETFrameworkv4.0.30319System.dll'

The type System.Windows.Input.ICommand exists in both 'c:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0PresentationCore.dll' and 'c:WindowsMicrosoft.NETFrameworkv4.0.30319System.dll'

如果有人能提供一些有关导致它的原因和/或如何解决它的见解,我将不胜感激.

If anybody could provide some insight on what is causing it and/or how to fix it I'd be grateful.

谢谢.

推荐答案

c:WindowsMicrosoft.NETFrameworkv4.0.30319System.dll

c:WindowsMicrosoft.NETFrameworkv4.0.30319System.dll

消息是准确的,ICommand 确实存在于 .NET 4.5 的两个程序集中.问题是您对 System.dll 的引用,您的项目使用了错误的.Microsoft.NET 目录中的程序集不再适合用作参考程序集,就像它们在 .NET 4.0 之前的 .NET 版本中一样.它们应该不再存在,但不幸的是需要它们来构建 C++/CLI 项目.

The message is accurate, ICommand indeed exists in both assemblies for .NET 4.5. The problem is your reference to System.dll, your project is using the wrong one. The assemblies in the Microsoft.NET directory are no longer suitable to act as reference assemblies, like they were in versions of .NET prior to .NET 4.0. They should no longer be there but unfortunately are required to get C++/CLI projects built.

您对 PresentationCore.dll 的引用是正确的,它使用 c:program files eference 程序集子目录..NET 4.0 及更高版本中参考程序集的正确主页.这些程序集特殊,它们只包含元数据,而不是运行时程序集的副本.

Your reference to PresentationCore.dll is correct, it uses the c:program files eference assembly subdirectory. The proper home for reference assemblies in .NET 4.0 and up. These assemblies are special, they contain only metadata and are not a copy of the runtime assemblies.

您需要修复您的项目.System.dll 可能不是唯一存在此问题的程序集.打开你项目的References节点,一一验证.通过使用 Project + Add Reference 删除指向 Microsoft.NET 的坏的,并用好的替换它们.最好将它们全部更换以确保.

You'll need to fix your project. System.dll is probably not the only assembly that has this problem. Open the References node of your project and verify them one by one. Remove bad ones that point to Microsoft.NET and replace them with good ones by using Project + Add Reference. Best to just replace them all to be sure.

这篇关于类型“System.Windows.Input.ICommand"存在于“PresentationCore.dll"和“System.dll"中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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