Dragan
Dragan

Reputation: 3743

Adding this project as a reference would cause a circular dependecy

I'm working on an MVC 3 project. I was told to get all the models and viewmodels out of the projects and put them in a class library so that they can be referenced from different types of projects. However, now that I've transferred all the viewmodels and models from the web project to a class library, and removed all the references to the web project, I cannot set reference to the class library from my web project with the reason stated in the question title. WHy is this happening? In my class library I'm not referencing the main project anywhere!!! Any suggestions? Thanks a lot!!

Upvotes: 0

Views: 4060

Answers (2)

Musikero31
Musikero31

Reputation: 3153

Experienced this earlier. Check the project that you are going to add if it has the reference to the project you are adding in it.

Example: Project A with reference to Project B. Then in Project B, you're adding Project A as reference.

Upvotes: 1

zebra
zebra

Reputation: 1338

well this usually happens for a reason, and this is that there is a cirrular reference,maybe not a direct one but an indirect one (through third project, how many projects do you have in your solution?).

In your library project remove all other projects references from solution, and try it again.

good luck almir

Upvotes: 0

Related Questions