I having "Could not load file or assembly or one of its dependencies" problem.
Could not load file or assembly 'IronPython, Version=2.7.7.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I'm installed the IronPython with NuGet package and run the project. Finally, I got this error.
Any ideas how I should go about solving this?
Related
I am trying to use Azure Blob Storage, however I am getting the following error.
System.IO.FileLoadException: 'Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
I have viewed other solutions on Stackoverflow that suggest changing from "Any CPU" to "x64", Doing a clean then build, and making the app.config match the version in the packages.config. None of these things solve the problem.
I am using Visual Studio 2019 and .NET Framework 4.7.2
The offending line of code is
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
Can anyone provide some insight on why this is happening?
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?
You are using the unsigned Nuget package and you need the dll's to be signed. Probably because your application is signed as well.
So the dll's need to have a strong name. That can be done just as Selvin said: "you have to either ask developer of this assemblies to sign 'em ... or get the code, generate key, compile and sign 'em by yourself".
The official MongoDB drivers are not signed, but there is an unofficial signed MongoDB driver Nuget package of these three files. See here, here and here. When you use these packages your problem might be solved.
The other solution is to sign the drivers yourself by building it from source/scratch.
Whether or not to sign your application is discussed here.
I have a solution with 5 projects, one of them is a unittest and another one is an API Rest (donno if this is relevant hehe) . The problem I have is that when I added this unittest, I couldn't debug again my API, all the time a ' System.IO.FileNotFoundException' appears and I can't do nothing.
How could I fix this problem?
I tried removing all references via Visual Studio but still it is not working.
Could not load file or assembly 'Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Thanks!
I am trying to write a 'hello world' application with a dependency to an assembly of a CAD software (SpaceClaim). I add the assembly SpaceClaim.Api.V12.dll to my references and build without problems. When I try to run the application I get the following error:
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly 'SpaceClaim.Api.V12, Version=12.1.11373.0,
Culture=neutral, PublicKeyToken=7210645d4d5e3a39' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'SpaceClaim.Api.V12, Version=12.1.11373.0, Culture=neutral,
PublicKeyToken=7210645d4d5e3a39'
---> System.IO.FileLoadException: Could not load file or assembly 'SpaceClaim.Api.V12, Version=12.1.8703.0, Culture=neutral,
PublicKeyToken=7210645d4d5e3a39' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) File name:
'SpaceClaim.Api.V12, Version=12.1.8703.0, Culture=neutral,
PublicKeyToken=7210645d4d5e3a39'
(this error message is also discussed here)
After checking the GAC, I can see that there is an assembly with same strong name with the one I am referencing (Version=12.1.8703.0). However when I open these two with a disassembler (ILSpy), I see that they target different runtimes, the one I am referencing targets .NET 2.0 and the one in the GAC .NET 4.0.
I would like to ignore the one in the GAC and pick from the local directory the one that targets NET 2.0. Apparently, simply copying it into the same folder with the executable is not enough. From what I 've read so far here and here, in order to do this, one needs to 'remove the signing' from the assembly. I don't have much experience with .NET so I am wondering, is this something that I can do with 3rd party assembly and if yes how? Or what other alternatives I have? The two assemblies have the same strong name so putting them both in the GAC is not an option as far as I understand.
Under the references for the class library I changed the removed the old version of dll and added the new dll. When ever my business logic library tries to create an object to this library it gives me the following error:
eConnect = new EConnectIntegrationGroup(cnString);
Could not load file or assembly 'Microsoft.Dynamics.GP.eConnect.Serialization, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located
assembly's manifest definition does not match the assembly reference. (Exception from HRESULT:
0x80131040
your business logic is still looking for the dll with version 12.0.0.0. Is this the only place where the dll is used or do other projects also have this dll added to references?