Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
Is it a good idea to target both ef core 3.1 and 5?

I have a small nuget package that interacts with a small DB with 2 tables. I have used it in 2 projects, 1 is dotnet 5 and the other is an old dotnet framework 4.6 therefore I have targeted netstandard2.0 and it worked fine so far.

I need to update all the packages in the dotnet 5 one to the latest, but ef core 5 needs dotnet standard 2.1. What is the best way to deal with it?

I thought about multi targeting, but first I don't know if it is a good idea or not and then I don't know how to say target dot net standard 2.1 with ef 5 and at the same time dotnet standard 2 with the ef 3.1.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Targeting multiple versions of EF Core (or any other package) can be OK, but bear in mind that it's going to affect the maintainability of the package, so only you can decide if it's worth it or not.

  • Are you going to benefit from any specific feature/performance improvement of EF Core 5?
  • Are different behaviors acceptable for you and your users? If not, revisit the previous point because you may need to tweak your code to achieve that, ignoring some EF Core 5 add-ons.
  • etc.

Regarding the implementation:

You can solve the project references issue by using Condition at ItemGroup level and checking the value of $(TargetFramework).

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.13" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.4" />
</ItemGroup>

In your C# code you'll need to make use of preprocessor directives (#if NETSTANDARD2_0) to differentiate both implementations.

You can read more detailed documentation about both .csproj and C# solutions here.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda