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.
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 ?
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?
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.
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?
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
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.
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.