Rob K
Rob K

Reputation: 8926

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

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?

Upvotes: 9

Views: 12429

Answers (2)

ViRuSTriNiTy
ViRuSTriNiTy

Reputation: 5155

The following note might not be the issue here but i got this error when i referenced a DLL that was created with VB.NET. VB.NET is not case sensitive therefore it might be possible that in project settings the namespace is stated as lowercase whereas in source code it's written as uppercase. The compiler then gets confused. In this case just check for lowercase / uppercase issues and fix it.

Upvotes: 0

krystan honour
krystan honour

Reputation: 6793

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.

Upvotes: 2

Related Questions