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

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

问题描述

我遇到了我无法弄清的错误。

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

我正在Windows 8和.net4.5上使用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)\参考
程序集\Microsoft\Framework.NETFramework\v4.0\PresentationCore.dll'
和'c:\Windows\Microsoft.NET\Framework\ v4.0.30319\System.dll'

The type System.Windows.Input.ICommand exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\PresentationCore.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll'

如果有人可以提供引起原因和/或如何解决的一些见解

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

谢谢。

推荐答案


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

c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.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文件\参考程序集子目录。 .NET 4.0及更高版本中参考程序集的正确宿主。这些程序集是特殊的,它们仅包含元数据,而不是运行时程序集的副本。

Your reference to PresentationCore.dll is correct, it uses the c:\program files\reference 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可能不是唯一出现此问题的程序集。打开项目的引用节点,并逐一进行验证。删除指向Microsoft.NET的不良代码,并使用Project + Add Reference将它们替换为不良代码。最好将它们全部更换以确保。

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.

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

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