Nuget troubles

Hi,
I am trying to import a Nuget (NuGet Gallery | Microsoft.CodeAnalysis.CSharp.Scripting 3.6.0-4.final) into a project, using VS nuget manager.
At first it seems to works fine, the namespace is recognized (Microsoft.CodeAnalysis), and I can access the library methods (specifically the Csharp.EvaluateAsync()). However, as soon that Unity compile or VSbuilt the project, the package is not recognized anymore and seems to hve disappeared from the references in VS.

These methods are not essentials to my project but I d like to understand what I am missing. (project settings are set on mono and standart 2.0).

Any help would be welcome !

Unity has a predefined set of assemblies and wipes any new ones as you mentioned.

Here is an blog about what’s going on.

They mention the following;

The difficulties of using NuGet with Unity boil down to the following issues:

  • Unity is built on an old version of Mono. So we are limited in what we can use from NuGet.
  • Unity sets our Target Framework by default to something that will prevent most NuGet packages from being installed.
  • Unity regenerates its Visual Studio solution, which wipes out installed packages.
  • Unity only recognizes DLLs placed under the Assets folder, by default NuGet won’t install packages where we want them.

I’m also trying to import the same package as you, I’ve followed various methods without any success due to shear number of dependencies.

If anyone has had any luck importing it and can offer advice that would be highly appreciated!

Hi all! Facing the same issue. Any success on your side?

Whatever you do, don’t even consider NuGet with Unity:

What an absolute disaster. The confusion and technical debt and extra work it imposed on our various teams trying to stick with NuGet definitely contributed to the ultimate failure and abandonment of several in-development titles.