I want to use some NuGet packages inside Unity. I achieved that Unity finds the downloaded DLLs according to this article (https://www.what-could-possibly-go-wrong.com/unity-and-nuget/). The nuget.config file can be configured to download the packages into the Plugins folder inside the Assets folder. The Problem is that NuGet downloads multiple versions of each DLL (eg net46, netcore50, netstandard21, so forth) and Unity doesn't like multiple DLLs with the same name. I know I could simply put the DLL inside the Plugins folder by hand, but unfortunately that is not a solution which would please me.
Do you have any idea how I could work around this problem? Is it possible to configure NuGet to just download one DLL for each dependency?
You really don't wanna go down the path of configuring Unity to work with Nuget automatically. That article is rather old. With Unity 2018, you get a .net standard 2.0 compatibility level, which should be perfect for Nuget packages. Simply download the package using a separate VS project (as mentioned in the article), then take the netstandard20 version of the DLL and place it in your Unity project.
You have to set up the downloaded nuget /is in packages folder/ plugins manually. Nuget doesn't know which plugin can use unity and how. You can set their parameters in inspector: editor, standalone ... x86,x64 ...
Just thought I'd add this in case it helps anyone
I used the Nuget for Unity asset (free) to import a package (websocketsharp) and it was really easy and painless. The references in VS worked immediately as well
The package you're trying to import naturally has to be compatible with Unity but that's the same even if you import it manually. So I'd recommend giving this a try
There is NuGet2Unity that allows to convert any Nuget package to a '.unitypackage'. I've used it to convert "SpecFlow" and i was able to import the resulting Unity Package. Check out their Examples.
It worked for me with:
Note that you might need to skip dependecies that are deliverd by the NugetPackage which are already deliverd by unity itself.