Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

renaming a third party dll in .net

Tags:

c#

.net

dll

I have created one tool using console application named "DocumentHashcode" in which I am using third party DLL - DocumentFormat.OpenXml.dll.

When I'm going to deploy it, I am using DocumentHashcode.exe and DocumentFormat.OpenXml.dll for running the application.

I want to rename DocumentFormat.OpenXml.dll to CATBldHashCodeSupporterDll.dll. Can anyone advise how to achieve this?

like image 547
Alpa Avatar asked Jan 09 '13 07:01

Alpa


1 Answers

You need to manually load the assembly. The simplest way is to load it before the JITer tries to load the DocumentFormat.OpenXml namespace. You can manually load it like this:

var dllPath = Path.Combine(Directory.GetCurrentDirectory(), "reNamed.dll");
Assembly.LoadFile(dllPath);

Alternatively you could listen to the AppDomain.AssemblyResolve event, which gives you the chance to load the renamed DLL once the JITer has failed to find it.

like image 86
David Pond Avatar answered Sep 23 '22 15:09

David Pond