Collision with GridFS in the new version of MongoDB.EntityFrameworkCore package

Error:

The type 'GridFSFileInfo' exists in both 'MongoDB.Driver.GridFS, Version=2.30.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

Using:

<PackageReference Include="MongoDB.Driver.GridFS" Version="2.30.0" />
<PackageReference Include="MongoDB.EntityFrameworkCore" Version="8.2.0" />

Hi @Borja_Dominguez,

Welcome to the MongoDB Community Forums! The reason for the conflict might be that v8.2.0 of the EF Core provider is built with the C# Driver 3.0.0 as a dependency. In the new version of the driver, GridFS is included with the driver as seen here and not needed as a separate package.

This might help resolve the conflict but can you elaborate on your use case since EF Core does not support GridFS to read back the chunk of files? You can use the MongoClient itself to leverage the underlying drivers capabilities but not via the DbContext in EF Core. Hope that helps.

Thanks,

Rishit.

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

Ok, removing the NuGet package dependency from GridFS solved it as you say.

The confusing thing is that it’s not clear that you have to do that to fix it because even going to the NuGet page nothing comes up in the package description: