Issues in Unity with NuGet C# Driver Package

Hi,
I am trying to get the C# NuGet driver to work with Unity.
So I used NuGet (for Unity) to load and install the driver.
There are two issues with the package:

  1. the package MongoDB.Libmongocrypt.1.6.0 contains a number older versions of the library
    under a subfolder “…content files/any”. Since those folders contain files with the same name Unity complains about the file names not being unique. This can be mended by just deleting that folder.
    It is anoying however and left me wondering and researching some time as to which I should use and whether I could just delete the ones I don’t need. Maybe you could make a package without the other versions.

  2. the package also depends on Snappier 1.0.0.
    For this Unity logs this error:
    “Assembly ‘Assets/Packages/Snappier.1.0.0/lib/netstandard2.1/Snappier.dll’ will not be loaded due to errors:
    Snappier references strong named System.Runtime.CompilerServices.Unsafe Assembly references: 4.0.6.0 Found in project: 5.0.0.0.
    Assembly Version Validation can be disabled in Player Settings “Assembly Version Validation””

So there seems to be a mismatch in versions and I don’t know how to remedy that. I definitely do not want to deactivate version validation!
Any help would be deeply appreciated!

Regards
Scheuni

We ran into similar issues You can find our solution at then of this thread:

Hope that helps.

Hi Martin,
many thx fr your reply. Good to know that other people are facing similar problems (is it just me or…). :slight_smile:
I am working under Win10 though using Unity 2021.3.16f1 (LTS)
After finding some feedback on Stackoverflow I managed to pull this off (similar to your approach):

  1. Download the current NuGet MongoDb driver
  2. Copy all .net Standard 2.0 version of the DLLs into a Plugin folder in my Unity project.

It seems to be working but now Unity is crashing quite often so I am not all that content yet. I will have to investigate the cause from the logs - will report if anything seems connected to the driver.

Many thx again
Scheuni

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.