3

I have this c# project...i add this reference (a dll) to it, and try to use that library in my code.

I use what its called (its a database connector)

MiDB myDb;

it doesnt find that, i can right click and say "resolve" usings... that adds this line to the top:

using ThePackage.Database.AoNM.MiDB;

blah blah

So this works, it sees it, i can even then call a method that is seen:

myDb.InitDB("stuff here");

bingo. the minute I build this, it says it cannot find ThePackage, and its like that usings, or reference doesn't exists. In the solution explorer it is still there? I can remove the reference and add it again, and then this same thing happens, it "seems" like its there, but going to build and run it "goes away".

It might be cause its late, but I am honestly totally lost as to why C# (2008) is doing this to me?

DLL was built in 2008 to... maybe im missing some build option with the dll?

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
Codejoy
  • 3,722
  • 13
  • 59
  • 99
  • okay i will add that the project is a 2010 that im trying to build it in, using a dll built with 2008 c#. Does this matter? – Codejoy Nov 20 '11 at 07:57
  • No that doesnt matter - odd. Does the using-directive actually dissppear? Or just not work? – Marc Gravell Nov 20 '11 at 08:10
  • possible duplicate of [C# Visual Studio 2010 suddenly can't see namespace?](http://stackoverflow.com/questions/4880685/c-sharp-visual-studio-2010-suddenly-cant-see-namespace) – Hans Passant Nov 20 '11 at 09:58

3 Answers3

3

I had same problem. You need to change target framework of your project from ".Net Framework 4 Client Profile" to ".Net Framework 4"

It worked for me.

Jack
  • 167
  • 1
  • 7
3

Check that the dll and the assembly run on the same CPU type (x86-x64). I used to have similar errors (and very strange error messages) when they were different.

Haedrian
  • 4,240
  • 2
  • 32
  • 53
1

if the dll is using a higher .net framework version than the application, you would see this. it's probably unlikely the way i read what you said in the comment in that the application is in visual studio 2010 and the dll was built with visual studio 2008. not completely sure that's the case, though, as the quesiton cites visual studio 2008. anyway, check that you are using the same framework version or greater in the referencing project as in the referenced.

Dave Rael
  • 1,759
  • 2
  • 16
  • 21
  • also check to make sure you're not using the client profile in the referencing application and full in the referenced. – Dave Rael Nov 20 '11 at 15:26