Kaan
Kaan

Reputation: 896

Project Reference Problem, Visual Studio 2010

I have a solution that has one class library project, and the others are WPF applications. I have added class library's reference the but, but both of them cannot use its classes.

So, what is the problem?

NOTE: sorry for tags, it's safari's problem.

Upvotes: 18

Views: 14828

Answers (4)

Moha
Moha

Reputation: 181

I got the same problem, but the solution was different...

We work in team and one of the developers (called dev1) installed the .NET 4.5 (the others has only the .NET 4.0). After dev1 made some changes in the solution the others got the problem, and colud't build. The project referrences didn't work (but if they used it like a dll it worked)... So we install the .NET 4.5 for everybody and it resolved the prolem.

Moha

Upvotes: 2

Kaan
Kaan

Reputation: 896

Found the problem. One of my references in class library has caused it, and I have removed it. Now I can built the solution without errors.

Thanks for your comments..

Upvotes: -1

Registered User
Registered User

Reputation: 1640

Make sure that all your projects target same Framework. It may be a case that your library class project targets full .Net Framework 4.0 while your wpf projects target .Net Framework 4.0 Client Profile.

To do that go to project properties of each project in a solution and check Application | Target Framework property. Alternatively you can download VSCommands 2010 extension and see all properties in one place via Solution Properties window.

Upvotes: 79

Jon Skeet
Jon Skeet

Reputation: 1500515

Things to check:

  • The class library classes are public
  • You have an appropriate using directive in your calling code:

    using MyCompany.ClassLibrary;
    

If that doesn't help, please post what happens when you try to use the classes from the library.

Upvotes: 2

Related Questions