Search Unity

Why is NET_STANDARD_2_0 expected with Entities 0.3.0-preview?

Discussion in 'Entity Component System' started by MNNoxMortem, Dec 8, 2019.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    Out of curiosity:
    Code (CSharp):
    1. #if !NET_STANDARD_2_0
    2. #warning Project is expected to have API Compatibility Level set to .NET Standard 2.0
    3. #endif
     
    jashan likes this.
  2. LazyGameDevZA

    LazyGameDevZA

    Joined:
    Nov 10, 2016
    Posts:
    143
    Overall .NET is moving away from the .NET framework of old. .NET Core 3 is the latest version in the Core series and going forward the next version will be .NET 5. Unity transitioning to .NET Standard 2 compatibility is likely just them moving towards being closer to ready for .NET 5, because .NET Standard is currently the only standard framework that bridges the gap between .NET of old and .NET Core.

    See the link below for extra information on the future of .NET.

    https://devblogs.microsoft.com/dotnet/introducing-net-5/
     
  3. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    Is there any official information about this? Do we really need to switch compatibility level back to .NET Standard 2.0 to be able to use DOTS properly? Or is it safe to ignore?
     
    jashan likes this.
  4. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    260
    .NET Standard 2.0 is more or less equivalent to .NET 4.6.1.

    Microsoft explains the different .NET versions here:

    https://docs.microsoft.com/en-us/dotnet/standard/net-standard

    So you are not switching to a lower level .NET when using .NET Standard 2.0. Microsoft will be releasing .NET 5 in November that will be all encompassing and replace the confusingly named .NET Cores and .NET Frameworks going forward (although I have no idea when Unity will upgrade to .NET 5).
     
  5. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    I'm perfectly aware about .NET 5 and what is .NET Standard 2.0. I was more interested in why exactly this is the requirement for Entities package and what can go wrong if we continue to use .NET 4.x compatibility mode?
     
  6. LazyGameDevZA

    LazyGameDevZA

    Joined:
    Nov 10, 2016
    Posts:
    143
    My understanding is that they are relying on newer features of C#, which isn't compatible with .NET 4.x. .NET Standard 2 is helps with an easier to .NET Core and ultimately .NET 5, but it is likely still going to take some time.
     
  7. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    792
    .NET 4.7.x implements Standard 2.0, so in my opinion, the warning make no sense.
     
    jashan, arminelec, bac9-flcl and 2 others like this.
  8. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Still getting this in Unity 2019.4.8, Entities 0.11.1 and broke my builds by switching to .NET Standard 2 because I need access to the registry (on Windows). According to .NET Standard and Microsoft.Win32.Registry conflict Editor / Runtime (here on the forums), using .NET 4.x is the correct way when we need access to these APIs.

    For what I'm doing with Entities / Burst so far, .NET 4.x does not seem to hurt. .NET Standard 2.0 does hurt a lot (breaks the builds).

    So the warning really only seems confusing.