CarterCommunity / Carter

Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
MIT License
2.05k stars 172 forks source link

Can't update Carter to 8.2.0 #351

Closed Misiu closed 4 weeks ago

Misiu commented 1 month ago

I want to use ValidateAsyncMethod from version 8.2.0, but when I try to update the package I get this error:

Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 4.7.0 directly to project Test.M.Sms to resolve this issue. 
 Test.M.Sms -> Carter 8.2.0 -> Microsoft.CodeAnalysis.CSharp 4.7.0 -> Microsoft.CodeAnalysis.Common (= 4.7.0) 
 Test.M.Sms -> Microsoft.EntityFrameworkCore.Design 8.0.6 -> Microsoft.CodeAnalysis.CSharp.Workspaces 4.5.0 -> Microsoft.CodeAnalysis.Common (= 4.5.0). Test.M.Sms  E:\DEV\Test.M.Sms\Test.M.Sms\Test.M.Sms.csproj  1       

I have these packages in my project:

  <ItemGroup>
    <PackageReference Include="Carter" Version="8.1.0" />
    <PackageReference Include="FluentValidation" Version="11.9.1" />
    <PackageReference Include="MassTransit.EntityFrameworkCore" Version="8.2.2" />
    <PackageReference Include="MassTransit.RabbitMQ" Version="8.2.2" />
    <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
    <PackageReference Include="SMSAPI.pl" Version="2.2.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
  </ItemGroup>

This is a simple .NET 8 Minimal API project that is using Carted an EF.

Misiu commented 1 month ago

This is probably because of https://github.com/CarterCommunity/Carter/pull/349/files#diff-4a815cf9962719b3fd4c082997b59b3813018a6fe71c4ecea06e79e8566f417bR29

jchannon commented 1 month ago

Not sure this is really a Carter issue. I could argue it's a Entity Framework Problem.

The version Carter uses is actually out of date too.

Misiu commented 1 month ago

To be honest I don't know what the best solution would be, but lowering the Nuget version in Carter solved.the issue. I think the bump in EF will happen in the .NET 9 release, so for now.the wastes solution would be to probably lower the required version in Carter.

Any chance this might be merged?

jchannon commented 1 month ago

I'm afraid not, sorry

Misiu commented 1 month ago

That's sad news to be honest. Any particular reason for that? The issue is solved, all tests pass.

I can always fork the repo and release a custom version to Nuget, but I'd prefer to stay with the official package.

I'll report the issue to EF team, let's see what they say.

Anyways, thank you for such fast reply:)

Misiu commented 1 month ago

The current workaround is installing these packages directly in the project:

<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />

as suggested in https://github.com/dotnet/efcore/issues/32070