Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

The new .NET Standard 2.1 is not compatible with the EPPlus library on NuGet.

Discussion in 'Experimental Scripting Previews' started by zhuxianzhi, Aug 27, 2021.

  1. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    122
    Unity version: 2021.2.0b8.
    EPPlus version: 5.7.4 https://www.nuget.org/packages/EPPlus/

    I used a .net5 program to install from nuget, and found the file directory of the library, copied the dll under netstandard2.1 to Unity Plugins.



    Code (CSharp):
    1. Assembly 'Assets/Plugins/EPPlus.dll' will not be loaded due to errors:
    2. Unable to resolve reference 'System.Drawing.Common'. Is the assembly missing or incompatible with the current platform?
    3. Reference validation can be disabled in the Plugin Inspector.
    4. Unable to resolve reference 'System.Security.Cryptography.Pkcs'. Is the assembly missing or incompatible with the current platform?
    5. Reference validation can be disabled in the Plugin Inspector.
    6. Unable to resolve reference 'Microsoft.IO.RecyclableMemoryStream'. Is the assembly missing or incompatible with the current platform?
    7. Reference validation can be disabled in the Plugin Inspector.
    8. Unable to resolve reference 'Microsoft.Extensions.Configuration'. Is the assembly missing or incompatible with the current platform?
    9. Reference validation can be disabled in the Plugin Inspector.
    10. Unable to resolve reference 'Microsoft.Extensions.Configuration.FileExtensions'. Is the assembly missing or incompatible with the current platform?
    11. Reference validation can be disabled in the Plugin Inspector.
    12. Unable to resolve reference 'Microsoft.Extensions.Configuration.Abstractions'. Is the assembly missing or incompatible with the current platform?
    13. Reference validation can be disabled in the Plugin Inspector.
    14. Unable to resolve reference 'Microsoft.Extensions.Configuration.Json'. Is the assembly missing or incompatible with the current platform?
    15. Reference validation can be disabled in the Plugin Inspector.
    How to use the nuget package compatible with NET Standard 2.1?

    PS: In 4.x and NET Standard 2.0, I can use the EPPlus library for the above operations.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Is it possible to use the .NET Standard 2.0 version of EPPLus with 2021.2.0b8 still?

    I see that both the .NET Standard 2.0 and .NET Standard 2.1 assemblies reference all of those assemblies that cause the error. I'm surprised the .NET Standard 2.0 version actually worked with Unity.
     
  3. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    I guess you have to download all dependencies. 4.X had most of them included.
     
  4. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    122
    I used .net 3.5x EPPlus.dll which can run on netstandard2.1.
     
    JoshPeterson likes this.
  5. aybe

    aybe

    Joined:
    Feb 20, 2019
    Posts:
    55
    @JoshPeterson

    I just realized that while Unity itself supports .NET Standard 2.1, it will not load a .DLL plugin dropped in /Assets that is written using it, the only framework it accepts being .NET Standard 2.0.

    Are there any plans in supporting .NET Standard 2.1 plugins ?
     
  6. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    792
    I added a .NET Standard 2.1 DLL in a project (2021.2) and it works. Are you sure that you didn't accidentally use the .NET core 2.1 version? Assambly info says .Net 4, x, but should that only be a display error?
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Yeah, this should work as @runner78 said. What is the error message you see @aybe?
     
  8. aybe

    aybe

    Joined:
    Feb 20, 2019
    Posts:
    55
    Indeed it's the correct one.

    My bad, today it finally decided to work, it didn't want to work when I tried the day before for the whole afternoon.
    Though it does appear that in my case a restart of Unity does really help, not sure why...

    Now I'm facing another issue which is probably beyond the scope of this forum: neither Rider nor ReSharper+VS want to recognize the namespace for the .NET Standard 2.1 library, but Unity doesn't complain at all and the project builds fine.