Kasrak-1517 avatar image
0 Votes"
Kasrak-1517 asked DylanZhu-MSFT commented

Cycle detected for a common library

Here I get Cycle detected error,

There is one really irritating error that I also encountered earlier, which may seems famous for some.

I get this error:

 Install-package : NU1108: Cycle detected. 
   Company.NugLib-> Company.NugLib(>= 0.9.108).

Most of the times it installs successfully, but in the build time gives the same error.

Imagine, we have a main library that all our libraries and apps want to use it, we have tens of libraries, here as an example:

 Main uses Lib1 and Lib2
 Lib2 uses Lib1
 All will use our **NugLib**

I need NugLib only privately for each project, they will use it for their own, for example Lib2 doesn't need NugLib as a Lib1's dependency.

Earlier saw some solutions and discussions, which seems they shouldn't apply in my case.
Just I guess cause all the libs have that dependency it may caused this. (not sure)
Tried to test also with PrivateAssets = all , which I never used earlier, and don't know why it seems not working, cause most of the time I see the small yellow triangle badge on my packages.

This error is too irritating for me curently, I am trying to build a reusable platform which using MSBuild.
I can provide a Live Share in Visual Studio if needed to resolve it.

· 10
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The error seems to mean that the name of your project is same as the nuget package. Maybe you could rename your project, for example: Company.NugLib_proj.

0 Votes 0 ·

Thanks Dylan,
Saw that in probable solutions,
But thought my shouldn't be wrong,
Do you mean that the library itself which is another solution
Shouldn't have its project named the same as the Nuget package?

Let me try it.

0 Votes 0 ·

Checked, It isn't the same,
It's name is just "NugLib.csproj" not Company.NugLib,
Company.NugLib uses CoreCompile
Guess After Build I couldn't see that error, in another hand I also had some successful installation.
So I thought here it could be cause of dependencies.

0 Votes 0 ·

I also used these tags which are all the same in the project: Product, PackageId, Title

0 Votes 0 ·

Changed it completely, no difference.

0 Votes 0 ·

Changed the .targets file with BeforeTargets="PreBuildEvent" instead of CoreCompile it worked on the lib1 but not on the lib2, which also referenced lib1. REally need help on this, can you please look at the code via LiveShare?

0 Votes 0 ·

Sorry for the delay in reply. Since the policy, I can just provide support in the forum.
Could you provide some codes or sample with basic steps through using one drive?I will download and test it on my side, and then provide a solution as soon as possible.

0 Votes 0 ·
Show more comments

0 Answers