Skip to content
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

Installing a package with with a version lower but compatible with the .NET version of the project is impossible #553

Open
jborlido opened this issue Aug 8, 2023 · 9 comments

Comments

@jborlido
Copy link

jborlido commented Aug 8, 2023

Description

The problem is that when I try to install a NuGet package that has a DLL which is compatible with the .NET version of my Unity project but lower than that same version, it does not keep it in the project. I had to manually download and install this NuGet package on my project. It would be nice if versions lower but compatible could be downloaded and kept as well.

  • NuGet Package: Mono.Posix.NETStandard 1.0.0
  • NuGetForUnity Version: 3.1.3
  • Unity Version: 2021.3.11f1
  • Operating System: Mac
@igor84
Copy link
Collaborator

igor84 commented Aug 8, 2023

That package seems to only have an implementation DLL for net40 and not for netstandard so in order to use it you would need to set your Unity project to use .NET Framework instead of .NETStandard in project settings and then the package will properly install.

@jborlido
Copy link
Author

jborlido commented Aug 8, 2023

The .NETStandard package I'm using does contain a dll for .NET 2.0 because I had to download manually and install it on my project.
Changing the .NET version of my project is not an option.

@popara96
Copy link
Collaborator

popara96 commented Aug 8, 2023

.NETStandard 2.0 dll is in the ref folder which is reserved for referenced libraries afaik. NuGet for Unity looks for dlls inside lib folder, and Mono.Posix.NETStandard 1.0.0 package only has net40 folder inside lib, which is rendered as incompatible. It might not need .NETFramework functionalities for everything so some things might work, but some you might discover won't work only in the build. That is why NuGet for Unity can't just accept installing packages like this.

@JoC0de
Copy link
Collaborator

JoC0de commented Aug 8, 2023

Can't you just uses Mono.Posix this has a dll for netstandard 2.0

@jborlido
Copy link
Author

jborlido commented Aug 9, 2023

I tried that as well, didn't work out

@popara96
Copy link
Collaborator

popara96 commented Aug 9, 2023

@JoC0de that package is shown only if Show Prerelease is checked (@jborlido FYI). It seems to not delete its netstandard2.1 folder when I install it in Unity 2021.3.12f1 (similarly it leaves netstandard2.0 folder in 2018.4.36f1) from lib in my case, which should be its expected behaviour. Although it does show some errors when installed (note that the error occured only in Unity 2021 and not in 2018 when I tested it). Screenshot attached.
image

@JoC0de
Copy link
Collaborator

JoC0de commented Aug 9, 2023

@jborlido can you explain why you even need the package? For me the package sent to not contain functionally that is not already in unity.
@popara96 ok this is strange i need to have a look

@jborlido
Copy link
Author

jborlido commented Aug 9, 2023

This is a dependency of another private package I'm using on my project.

@JoC0de
Copy link
Collaborator

JoC0de commented Aug 12, 2023

Ok I looked at it the package is relay strange:

  • Mono.Posix.NETStandard have no .dll for targeting netstandard (see comment of @igor84)
  • Mono.Posix.NETStandard depend on Mono.Posix but not as a dependency they specifying it as a frameworkAssembly (I don't know what this means and how this can be handled in the context of Unity)
    image
  • Mono.Posix seems to got renamed to Mono.Unix
  • Mono.Unix works for me, no compiler issues when I install it in Unity 2022.2.1f1
  • Mono.Posix / Mono.Unix includes native binaries that are needed by the package to run flawlessly. So even if you install the package you will probably get issues when running the code that is using the package. Currently NuGetForUnity currently doesn't support this see feat: Add support for native runtimes #421.
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants