Jhorra
Jhorra

Reputation: 6321

Referenced Library Not Recognized when compiled

I have created a simple Console application. I moved all my class files into a separate project because it is shared between this and a Asp.Net MVC application. I add the library fine. I add a reference to the project just fine. Everything looks good until it compiles, then it suddenly can't find the referenced namespace of the project. If I remove the using statement and add it back in the auto complete works fine and sees the project. It's only when building that it gives an error.

enter image description here

Upvotes: 0

Views: 205

Answers (1)

Leo
Leo

Reputation: 14820

At first sight it looks like you're not doing anything wrong. In the past, I've had issues similar to this and the main causes were...

  1. Both projects are targeting a different version of the .NET Framework. It can easily be changed from the project's Properties page
  2. There are compilation errors on the referenced assembly (class library in this case)
  3. The referenced assembly has some missing dependencies. It could be some like a reference to the System.Web assembly or System.Web.MVC, etc

Upvotes: 1

Related Questions