"Warning CS1684: Reference to type X claims it is defined in .. but it could not be found"

.net, .net-4.0, c#, visual-studio-2010

Solution

We really need more information, but here is how I have solved this.

Tends to be when you've added something by nuget or something like that, if you look in your app.config you'll see some redirects in there (probably) check the assembly that ICommand is in (usually in your bin folder or directly referenced) and ensure that the versions line up in there.

It would help if you posted your app.config and state the assemblies you are using so I can be more accurate.

Problem

I'm getting this warning when building a test project we'll call PWTests. Warning CS1684: Reference to type 'System.Windows.Input.ICommand' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.dll', but it could not be found This project is supposed to test a class library which we'll call PW. I cannot determine why it thinks System.Windows.Input.ICommand is defined in System.dll. PresentationCore, where ICommand is actually defined, is properly referenced in the test project, and the class library project. I've tried removing the reference to PresentationCore, cleaning, and re-adding it (as mentioned in other questions) which did not work. How can I determine what is causing it to think that ICommand is in System.dll?

Original source