Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cycles detected

My project does not add reference to another in the same solution.

I created a project for a website and and abstracted all the parts of the program into .Net Class Libraries (My models in a different class library, Interfaces in a different class library, business logic in a different class library). I referenced all the projects correctly and I also tried creating something I call EntityRepository which I initially kept the DbContext inside. But due to the reason that I wanted to use Microsofts' implementation of Identity and then scaffold the logic out, I could not find the DbContext from the other project which is required when scaffolding so I had to exclude that project out of the solution. Normally when you create a project and select Single user authentication, .Net core adds an initial DbContext into the project. So when scaffolding the implementation of AspNetCore Identity into my project, i have to choose the DbContext. Because of that, my business logic has broken into two sides. The other logic is inside another project in the same solution, the Identity and authentication is inside the startup project which is the web application. When I tried calling the services which implement the business logic from the other project into the web project, it could not add reference to the services project. I now added reference manually. After that I now saw an error written

Detail Error:
Severity    Code    Description Project File    Line    Suppression State
Error   NU1108  Cycle detected. 
  CBTSoftware.Web.Host -> CBTSoftware.Services -> CBTSoftware.Web.Host. CBTSoftware.Web.Host    C:\Users\Tavershima\source\repos\CBTSoftware\CBTSoftware.Web.Host\CBTSoftware.Web.Host.csproj   1```
How can I resolve this?
like image 854
Formula12 Avatar asked Dec 09 '25 22:12

Formula12


2 Answers

Fist I want to show gratitude to those who answered above because they put on the right track to solving this issue. In my case the issue was caused by untrack files causing NU1108 and was resolved by running git clean -fxd *git clean documentation

like image 162
patrick_candlin Avatar answered Dec 12 '25 12:12

patrick_candlin


I know that this is old but I'd like to add here as well.

I had the same situation as Sebastian Widz answer but what really worked for me was opening the Properties of the problematic project.

This reloaded the project files/dependencies and fixed the "Cycle Detected" issue.

like image 27
Guilherme Rocha Avatar answered Dec 12 '25 12:12

Guilherme Rocha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!