Reputation: 7210
I'm building an application using Visual Studio 2010 in which I have to use an external dll. While I'm coding, the IDE is not showing to me any errors about methods owned by this dll I added to my project. I can even browse the class object hierarchy. Once I try to compile my project, this reference is lost. I can't browse the reference anymore and I'm getting the usual error "does not exists in the current context". I've even recompiled the dll but I'm still having this error.
Upvotes: 3
Views: 3320
Reputation: 15327
you will get this error if
Your
DLL project
targeting different .NET Framework version than yourproject who uses this DLL
so make sure that your Referenced Project (DLL Provider)
is using the same version of .NET Framework
that your other project (DLL consumer)
uses
Upvotes: 0
Reputation: 8352
It could be an issue with the platform your project is targeting and the platform of the dll. Try specifying explicitly x86 or 64 and see what happens. If it work, then check if you are happy with that platform or if you will need to find the dll compiled for the other or if you will need to find another library.
Hope it helps
Upvotes: 0
Reputation: 5886
Try to check whether Visual Studio has set the Path to your dll correctly:
Right-click the dll and go to Properties. Then in the properties window you have one line stating the physical path to the dll.
I sometimes had the problem that this line was empty and therefor the dll was marked with a yellow questionmark.
If the line is empty filling in the correct path to your dll my solve your problem.
hope that helps, cheers
Upvotes: 0
Reputation: 4088
In your Project's properties, click on the "Application" tab. Check and see what the "Target Framework" is set to. I was encountering something similar to this before and it was all because the Target Framework was set to ".NET Framework 4 Client Profile" instead of ".NET Framework 4."
Edit
I'm not exactly sure why this solved the issue in my case with missing references, but it did work. I was following the recommendation of another SO link that I'll add if I can find again.
Upvotes: 10