-
Notifications
You must be signed in to change notification settings - Fork 392
Restore netstandard2.0 support for Mapster #849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
|
CI on ubuntu-latest fails trying to run net48 test targets because the runner image no longer has This PR now gates |
|
Correction: the MSBuild property is Net48 test targets are now gated behind |
Hi @DocSvartz. Windows (x86): including .NET Framework 4.8 (net48) (also net8.0/net9.0/net10.0) — 1,489 tests (0 failed) |
|
@asp2286 Ok 👍
|
@DocSvartz |
Fixes MapsterMapper#639 Includes packaging changes to ship a netstandard2.0 assembly again, plus test/CI updates to keep net48 tests running only on Windows.
1b59b75 to
15a8f22
Compare
|
@DocSvartz @asp2286 would prefer, if you would:
|
|
@DevTKSS I might be wrong, but potential incompatibility can occur if the machine has a runtime that doesn't support a LangVersion higher than the one set during compilation? |
|
@DocSvartz you can use net8 with all lower but if the user is not having net8+ then instead maybe only framework, he will get errors when the project here is using a specific hogher lang version. Thats why I would not set it explicitly then instead rely on the net standard 2.0 to provide all it needs and only those things it is meant to be capable of! |
|
@DevTKSS Yes, But then all the code would have to be downgrade to like netstandard2.0. And only those parts that will give performance in the new TFMs can be rewritten using #if NET8_OR_GREATER Otherwise, it will be a spaghetti monster of #if constructions 😅 (at least netstandard2.0 no nullable reference type) |
@DocSvartz 🤔 ehm... but this downgrading seems to be exactly what this PR suggests, "just" to have the netstandard2.0 and Framework compartibility:
and and the "Spagetti Monster" how you call the Conditionals is not as worse as it seems: and the "Spagetti Monster" how you call the Conditionals is not as worse as it seems. Of course, it adds some lines, but in my opinion this is simply the price of keeping legacy targets (even Microsoft does not actively bring out Framework features anymore) and let's assume realistically, this PR is about the But yes, I totally can understand them too! I was also annoyed of e.g. the cool Source Generators like CommunityToolkit.Mvvm was having has not been supported or relyable use-able with that Framework App I tryed to enhance with it! |
@DevTKSS I'm not against multi-targeting either.
As far as I understand, you are suggesting to adhere to approach number 2? Example |


Fixes #639
Why
The main
Mapsterpackage currently only targetsnet8.0+, which prevents consumers on .NET Framework 4.8 (and othernetstandard2.0-based targets) from upgrading.What changed
Mapstertonetstandard2.0(src/Mapster/Mapster.csproj).netstandard2.0(LINQExceptBy/IntersectBy, range indexing).RequiredMemberAttribute(string-based attribute check keeps behavior on newer TFMs while allowingnetstandard2.0compilation).IsExternalInitfornetstandard2.0.netstandard2.0-only references required for runtime code generation/dynamic binder (System.Reflection.Emit*,Microsoft.CSharp).Validation
dotnet build src/Mapster/Mapster.csproj -c Release -f netstandard2.0dotnet test src/Mapster.Tests/Mapster.Tests.csproj -c Release -f net8.0