C
C#2y ago
Thinker

❔ TargetFramework for targeting both Framework and Core

What's the TargetFramework you should use if you want interoperability with both Framework and Core? I think netstandard2.0 or netstandard2.1, right? This is for a project which has to target Framework 4.8.
32 Replies
Thinker
ThinkerOP2y ago
right hmm
sibber
sibber2y ago
4.0?
Thinker
ThinkerOP2y ago
actually 4.8
sibber
sibber2y ago
netstandard 2.1
Thinker
ThinkerOP2y ago
According to this, .NET Standard 2.1 doesn't support Framework at all https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-1
.NET Standard
Learn about .NET Standard, its versions, and the .NET implementations that support it.
Thinker
ThinkerOP2y ago
Standard 1.1 supports netfx 4.8... although it's missing so much stuff
jcotton42
jcotton422y ago
I'd use NS2.0
Thinker
ThinkerOP2y ago
Would that work with 4.8?
Henkypenky
Henkypenky2y ago
2.0 yes
Henkypenky
Henkypenky2y ago
Henkypenky
Henkypenky2y ago
Thinker
ThinkerOP2y ago
That says 4.6.1 tho oh lol I can read
Henkypenky
Henkypenky2y ago
xd
Thinker
ThinkerOP2y ago
or can't do math Only issue now is the fact things like Math.Log2 is missing catlost
LPeter1997
LPeter19972y ago
Definitely ns2.0, but I'd first try to make sure that I super extreemely have to target Fx
Thinker
ThinkerOP2y ago
This is for a mod targeting a game which runs on netfx 4.5 although which somehow has compatibility with 4.8
LPeter1997
LPeter19972y ago
There are polyfills for most things, and then there are hacks for others You can write log2 based on the log you have so that should be no problem
Thinker
ThinkerOP2y ago
Yeah I've already polyfilled STJ, System.Drawing, and a couple other things
LPeter1997
LPeter19972y ago
There's also PolySharp
Thinker
ThinkerOP2y ago
Already have that catsip
LPeter1997
LPeter19972y ago
As an alternative, you could multitarget to get some enhanced experience while coding Mainly null-checks and such
Henkypenky
Henkypenky2y ago
that way you can do like: #if NET48 bla #elife NET7 bla bla ?
LPeter1997
LPeter19972y ago
Yes but I don't advise it for conditional compilation But because analysis becomes better when NRT annotations and friends aren't just polyfilled
Henkypenky
Henkypenky2y ago
ah nice, gotcha
Thinker
ThinkerOP2y ago
Luckily source dot dot dot net exists, aka. copying the source implementation catsip
LPeter1997
LPeter19972y ago
Henkypenky
Henkypenky2y ago
mweh
sibber
sibber2y ago
wat whats the point of netstandard then
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Henkypenky
Henkypenky2y ago
"Given many of the API additions in .NET Standard 2.1 require runtime changes in order to be meaningful, .NET Framework 4.8 will remain on .NET Standard 2.0 rather than implement .NET Standard 2.1. .NET Core 3.0 as well as upcoming versions of Xamarin, Mono, and Unity will be updated to implement .NET Standard 2.1." ??? https://github.com/dotnet/standard/issues/859
Aaron
Aaron2y ago
mono mono supports netstandard2.1 which means unity, xamarin, and a few other things
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?