Home > database >  Resolving .NET assembly name collision
Resolving .NET assembly name collision

Time:10-20

I currently have a .NET application which references "SomePackage.dll" and "SomeUtilities.dll". SomePackage.dll is contained in a separate folder, and one of the assemblies it depends on is also named "SomeUtilities.dll".

In other words, I added a reference in my project to \somePath\SomePackage.dll, and there exists a file \somePath\SomeUtilities.dll that SomePackage.dll depends on. Since I already have a reference in my project to a assembly called SomeUtilties.dll, I could not add a reference to \somePath\SomeUtilties.dll.

As a result, when I try to run my application and initialize a module in from SomePackage.dll, I receive an error:

Could not load file or assembly 'SomeUtilities.dll..." or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.' 

To work around this, I used gacutil in the VS developer command prompt to add \somePath\SomeUtilities.dll to the GAC. Now both assemblies are resolved fine, but I was wondering if there was a better way to resolve this name collision that doesn't involve adding to the GAC. I'm worried about enter image description here

Remove the < assemblyBinding> reference.

Type in Package Manager Console: Add-BindingRedirect.

CodePudding user response:

Windows/.NET has a tool called FUSLOGVW.exe that will help find issues with assemblies. This tool is useful but sifting through the logs is cumbersome. There is an open source tool that is a wrapper around FUSLOGVW.exe and makes it much easier to sift through the data and find the root of the problem. I would use this

https://github.com/awaescher/Fusion

  • Related