RPD
RPD

Reputation: 494

MVC Visual Studio "circular dependency"

I have got a problem with "circular dependency" at the moment. I have got error because I have to add file .dll to another project but reference already exist in this project which I want to add. I don`t know what I have to do?

Error   1   SportsStore.WebUI.accessor: The reference to 'SportsStore.WebUI.dll' was not found in the list of this projects references  SportsStore.UnitTests

enter image description here

Upvotes: 0

Views: 764

Answers (1)

Sandrino Di Mattia
Sandrino Di Mattia

Reputation: 24895

By looking at the screenshot you just posted it looks like you are adding the SportsStore.WebUI project as a reference to the SportsStore.UnitTests and this failed because of a circular dependency. Does this mean your WebUI project already references the UnitTests project? If it does, then you have a problem with your design, because 'real' code should never reference test projects.

Now, in general, if you want to solve circular dependencies you could simply extract the common part in an separate assembly. Instead of the projects referencing each other, they'll reference that common assembly instead.

Upvotes: 1

Related Questions