Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why dll reference disappears when developing in VS2010?

I am creating a VS2010 console app using C# language on .NetFramework 4. I got a dll from a collegue of mine, the dll was developed in VS2010 VB on .Net Framework 3.5.

I added the reference to dll in the solution. I was able to identify the class and added one line to consturct the class. The intellisense idenified the class and showed me the overloaded methods for construction. Just after one line, I compiled the code. Now the compiler can not find the dll for some reason. I am getting the error

Error 4 The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)

The one line I added have the curvey line under the type. If I remove the dll and add it again, the line disappears as if VS found the reference. Now I build it again, I get the same error and back to square one. Is there something I am doing wrong? This happens only to this solution with this reference.

Thanks,

like image 237
Nair Avatar asked Apr 18 '11 19:04

Nair


1 Answers

Check your console application project properties. If it's using the .NET 4 Client Profile and the .NET 3.5 dll is using features not in the client profile, it won't work

To fix it, change from .NET Framework 4 Client Profile to .NET Framework 4

console app

like image 197
kenwarner Avatar answered Oct 07 '22 05:10

kenwarner