JonPSmith / AuthPermissions.AspNetCore

This library provides extra authorization and multi-tenant features to an ASP.NET Core application.
https://www.thereformedprogrammer.net/finally-a-library-that-improves-role-authorization-in-asp-net-core/
MIT License
764 stars 155 forks source link

Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 4.8.0 directly #112

Open raulidavid opened 1 month ago

raulidavid commented 1 month ago

NU1107: Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 4.8.0 directly to project Jiban.Application to resolve this issue. Jiban.Application -> RazorEngineCore 2024.4.1 -> Microsoft.CodeAnalysis.CSharp 4.8.0 -> Microsoft.CodeAnalysis.Common (= 4.8.0) Jiban.Application -> Jiban.Infrastructure -> AuthPermissions.AspNetCore 8.0.0 -> Microsoft.EntityFrameworkCore.Tools 8.0.2 -> Microsoft.EntityFrameworkCore.Design 8.0.2 -> Microsoft.CodeAnalysis.CSharp.Workspaces 4.5.0 -> Microsoft.CodeAnalysis.Common (= 4.5.0).

raulidavid commented 1 month ago

Please @JonPSmith review this issue

JonPSmith commented 1 month ago

Hi @raulidavid,

Are you using the latest version, AuthP version 8.0.0, which I released yesterday or an older version. The older version supported .NET 6, 7 and 8 and had some problems with Microsoft.CodeAnalysis... . Version 8.0.0 only supports .NET 8 and should be better, but maybe I missed something.

Let me know.

raulidavid commented 1 month ago

I am using the latest AuthP version 8.0.0

JonPSmith commented 1 month ago

Your error shows a difference of the Microsoft.CodeAnalysis.Common between your Jiban.Application project and your Jiban.Infrastructure project, which has AuthPermissions.AspNetCore in it. And the solution is in the error "add Microsoft.CodeAnalysis.Common 4.8.0 directly to project Jiban.Application". But why??

When I compiled 6.2.0, which supports .NET 6, 7 and 8, I had the same problem as yours and the solution was to do what the error says - add a Microsoft.CodeAnalysis.Common version ???. But when I created 8.0.0 I didn't need to add any Microsoft.CodeAnalysis.??? any more because there wasn't a crashing of any of the analysers.

Things to try:

  1. If you were using AuthP 6.2.0 before, and updated to AuthP 8.0.0, then I would be a good idea to use "Build>Clean Solution" and then "Build>Rebuild Solution". Maybe it will sort out the analysers.
  2. Try AuthP 6.2.0 to see if there is a difference.
  3. If nothing else works then just add Microsoft.CodeAnalysis.Common 4.8.0 directly to project Jiban.Application as the error says.
JonPSmith commented 1 month ago

Hi @raulidavid,

Can I close this issue? It would useful if you could add a comment saying which approach works for you. That would help other users if they have the same type of problem.

raulidavid commented 1 month ago

I am using the latest version of authp v8.0.0 but I am inheriting from legacy authp classes, I am going to validate it