NuGet and Snappy libraries impact on VCS (GIT)


The dotnet (C#) drivers 2.11 brings supports for Snappy compression.
When the driver is installed from NuGet, this adds 3 content files to the targeted project.
(snappy32.dll, snappy64.dll, libzstd.dll)

As those libraries are defined as content files and not references, they are not copied over the project during a simple NuGet restore.

When working with VCS (GIT, svn, …), it then mandatory to add those files to the repository.

This is really annoying, because one rule of thumb is to avoid pushing binaries to any VCS.

Is there an easy way to workaround this ?

Many thanks in advance for your suggestions

1 Like

Hello, This impacting gated build check-in failure , its not able to find these but locally its building without any issues

any idea how to proceed further on these?


Hi @Gauthier_Rossion and @Dasari_Sateesh,

It’s been a while since you posted this question, have you found a solution to this ?

I have just tested this with MongoDB.Driver version 2.11.5 (current stable) and it didn’t add those assemblies. Would you be able to confirm that this is the case with current version 2.11.5 ?

If this is still an issue for you could you share a minimal example of package.json that is able to reproduce this issue ? Also could you list where in the project directory would you find those assembly files are in ?


Hi @Wan,

I give it another try with the latest change and I didn’t see a difference in the package installation behaviour.

The 3 libraries are still added by file reference.

However, in the meantime Visual Studio got updated, and build errors does not occur anymore.

So I guess the issue I faced were linked to by dev environment.

However, my projects are actually not using the ‘snappy’ compression features.

As the libraries are still not present even after a NuGet Restore, I suspect the errors will come back once I decide to use them.

(Or perhaps some runtime errors)

I see this as well, and though it doesn’t seem to impact functionality, adding dlls to my project directly is very odd. Here’s what an empty project with just MongoDB.Driver 2.11.6 installed looks like:

This is on a .net framework 4.7.2 project.
If I install 2.12, it adds more binary references from the new cryptography nuget that MongoDB.Driver depends on.
Is this by design?

Hi @Ivan_Milenkovic ,

Unfortunately I’m still unable to reproduce this behaviour with MongoDB.Driver version 2.12.2 .

If you’re still experiencing this issue, would you be able to provide a minimal reproduce-able example project ? This is so that we can investigate more on what causing the dll being pulled.


1 Like

Hi @wan,

I tried it again, and I noticed that it does not happen on a .net 5 project. I’m assuming it won’t happen on a project that uses the new .csproj file format in general, and I suspect that’s why you aren’t able to reproduce.
Can you please try to include the nuget package in a fresh project targeting .net framework 4.7.2?


Hi @wan,

I can reproduce this when using a project targeting .NET Framework, but I do not get the same problem if I use .NET Core or .NET 5.0.

So I think this is an issue only affecting .NET Framework projects, and not .NET Core ones.


Hi @Ivan_Milenkovic, @Owain,

Unfortunately I’m unable to reproduce this issue using Visual Studio 2019 on a simple project targeting .NET frameworks on .NET Core, net5.0, net4.8, and net4.7.2.
The project only has a single dependency

  <PackageReference Include="MongoDB.Driver" Version="2.12.2" />

If you can reproduce this issue consistently, could you please upload a minimal example project into a GitHub public repository for reference ?


Hi @wan,

This issue is only happening if I use the NuGet Package Manager.

If I add just the MongoDB.Driver as a PackageReference to the .csproj file, then the snappy, libzstd, libmongocrypt, and mongocrypt files are not added to the project. However, will this cause any issues if compression or crypto are required? Also, if I use this workaround but reference an older version of the library, then the aforementioned files are added to the project when I update the package using the NuGet Package Manager.

I have created a git repo, mongo-snappy, with some replication steps and an example project.


1 Like

Hi @Owain,

Thank you for taking the time to document the steps with all of the information.
I have created a tracking ticket CSHARP-3612 for the MongoDB .NET driver developers to look into.

Please note that the presence of these dlls in the .NET project should not cause any issues.


1 Like

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