kaze
kaze

Reputation: 4359

Can't create valid reference to class library

IMPORTANT! I was confusing myself, being in another project/assembly than I expected. Things work ok, when I'm in the right place. Thanks for all help anyway, spend no more time on this one!

I have an MVC3 project, which uses an ClassLibrary-assembly. I would like to create instances from types in that class library from a console application (in the same solution).

I have made sure that I use the fully qualified name, since it's a different assembly than the console app. In my case, the type name is:

KIBS.DykrapportDomain.Model.DykRapport_Utrustning, DykrapportDomain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

I've added a reference to the class library project from the console project, it seems fine when I open it in the Object Browser, I can see everything inside. I have also made sure that the target framework is .NET 4 (not client profile) for either of the projects.

Still, when I add the following statement:

using KIBS.DykrapportDomain.Model;

I get an The type or namespace name 'KIBS' could not be found (are you missing a using directive or an assembly reference?)

What am I missing!?

Upvotes: 0

Views: 313

Answers (2)

Pushpendra
Pushpendra

Reputation: 538

Check the name space of the class which you want to create the inside the console application and if KIBS.DykrapportDomain.Model then it should work other wise use the namespace that is inside the class

Upvotes: 0

JTMon
JTMon

Reputation: 3199

Check your console application and make sure it targets the full .Net framework and not the the client Profile version.

Upvotes: 1

Related Questions