JasperFx / lamar

Fast Inversion of Control Tool and Successor to StructureMap
https://jasperfx.github.io/lamar
MIT License
563 stars 118 forks source link

.NET7 #360

Closed cheng93 closed 1 year ago

cheng93 commented 1 year ago

.NET 7 has been released

Require support target framework and relevant packages

For me

Microsoft.EntityFrameworkCore 7.0.0 -> Microsoft.Extensions.Logging 7.0.0 -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0) Lamar.Microsoft.DependencyInjection 8.0.1 -> Lamar 8.0.1 -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0 && < 7.0.0).

cheng93 commented 1 year ago

Side note: Stop supporting .NET5 ?

jeremydmiller commented 1 year ago

I'll leave the .NET 5 support in just to avoid being griped at by other folks

rizi commented 1 year ago

@jeremydmiller it seems that Lamar.csproj is not compiled for .Net 7 and also the item group for Net 7.0 is missing for Lamar.csproj

Here is the group for .Net 6.

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
    <PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[6.0.0, 8.0.0)" />
  </ItemGroup>

I think it should look like this for .Net 7.0

<TargetFrameworks>netstandard2.0;net5.0;net6.0;net7.0</TargetFrameworks>

<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
    <PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[7.0.0, 8.0.0)" />
  </ItemGroup>

What do you think? br

jeremydmiller commented 1 year ago

It got missed. It is tested in .NET 7. Easy fix, just got missed in both the PR and me reviewing the PR for that

On Nov 15, 2022, at 1:17 PM, rizi @.***> wrote:

Here is the group for .Net 6.

rizi commented 1 year ago

It got missed. It is tested in .NET 7. Easy fix, just got missed in both the PR and me reviewing the PR for that On Nov 15, 2022, at 1:17 PM, rizi @.***> wrote: Here is the group for .Net 6.

@jeremydmiller Thank you very much 👍

Would it be possible to also push an updated NuGet Package?

Btw Lamar.Microsoft.DependencyInjection has the same "issue".

I have sent you a PR: https://github.com/JasperFx/lamar/pull/369

Br

cheng93 commented 1 year ago

Whoops, didn't think it was needed in the main library, unless we were going to use specific features in .NET 7, as the IL would be the same

rizi commented 1 year ago

Whoops, didn't think it was needed in the main library, unless we were going to use specific features in .NET 7, as the IL would be the same

@cheng93 Hi, the problem (at least for me) was that NuGet sometimes resolved the wrong version of Microsoft.Extensions.DependencyInjection.Abstractions (under certain conditions). At least in .net 7.0 solutions.

Now as we also target .net 7.0 we can explicit use Microsoft.Extensions.DependencyInjection.Abstractions v7.0 for .net 7.0 and NuGet resolves the "correct" version of it.

Using .net 7.0 can also improve the performance, there has been a lot of work regarding performance and memory optimisation, of course I don't know if the performance gain is measurable in Lamar.

It was quite an easy fix because of your previous PR, thx for that.

Br