1

I have been working on upgrading my application to use the MongoDB 2.0 driver, but have hit a road block since MongoDB is not currently releasing a strongly named version of the assemblies. As a result I cannot build an assembly in my solution that gets registered in the Global Assembly cache (GAC) because GAC requires assemblies to be strongly named.

Using the technique explained on Ian Picknell's and Ryan Farley's Blogs I was able to strongly name the assemblies; MongoDB.Bson.dll, MongoDB.Driver.dll, and MongoDB.Driver.Core.dll. After strongly signing them I removed the old references to these assemblies and added references to the new strongly named versions. When I try to build the project in VS2013 2 errors(see below) are generated both of which are trying to reference the weakly named assembly (This is my understanding because the error states PublicKeyToken=null).

I've also tried building strongly named assemblies straight from the source code since MongoDB is open source but that has been generating hundreds of errors that i'm still working through.

Error   1   The type 'MongoDB.Bson.BsonDocument' is defined in an assembly that is not referenced. You must add a reference to assembly 'MongoDB.Bson, Version=2.0.1.27, Culture=neutral, PublicKeyToken=null'.

Error   2   The type 'MongoDB.Driver.IAsyncCursorSource`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'MongoDB.Driver.Core, Version=2.0.1.27, Culture=neutral, PublicKeyToken=null'.
HopAlongPolly
  • 1,347
  • 1
  • 20
  • 48

2 Answers2

3

I Installed the nuget package StrongNamer and it signed automatically the unsigned dependencies.

Strong Namer will automatically add strong names to referenced assemblies which do not already have a strong name. This will allow you to reference and use NuGet packages with assemblies which are not strong named from your projects that do use a strong name.

Cristian T
  • 2,245
  • 3
  • 25
  • 45
0

Read topic 331520 and Dirk Vollmar's answer (Also give him an upvote). The link he provides explained the problem I was encountering.

A quick summary of the problem was the original MongoDB.Driver.dll and MongoDB.Driver.Core.dll were built with a reference to the unsigned version of MongoDB.Bson, so I had to update the references inside of those DLL's to include the publickeytoken I used to sign the assemblies. All is explained by the .NET-fu article under the Foo, Bar, Baz section.

Community
  • 1
  • 1
HopAlongPolly
  • 1,347
  • 1
  • 20
  • 48