I wanted to add these assemblies MongoDB.Bson.dll, MongoDB.Driver and MongoDB.Driver.Core into GAC using gacutil.exe but got the following error
Failure adding the assembly to the cache: Attempt to install an assembly without a strong name
So, I installed MongoDB driver in my c# project using NuGet package manager, when I tried to sign assemblies with a strong name using this
[assembly:AssemblyKeyFile("C:\\Users\\DELL\\Desktop\\MyStrongKeys.snk")]
and build my project it gave me the following three warnings
CSC : warning CS8002: Referenced assembly 'MongoDB.Driver, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. CSC : warning CS8002: Referenced assembly 'MongoDB.Driver.Core, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. CSC : warning CS8002: Referenced assembly 'MongoDB.Bson, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.
And when I tried to run the project it gives me the following exceptions
System.IO.FileLoadException: 'Could not load file or assembly 'MongoDB.Bson, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)'
System.IO.FileLoadException: 'Could not load file or assembly 'MongoDB.Driver, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)'
System.IO.FileLoadException: 'Could not load file or assembly 'MongoDB.Driver.Core, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)'
I want to know how can we add these assemblies into GAC?