gluck / il-repack

Open-source alternative to ILMerge
Apache License 2.0
1.19k stars 217 forks source link

Merged DLL raising 'LoaderExceptions' and not sure how to resolve. #372

Closed will-luna-embark closed 2 months ago

will-luna-embark commented 2 months ago

I am using ILRepack to merge multiple DLLs into one to avoid version conflict of a third-party reference.

When stepping through the DLL it breaks at a portion that is included in the Merge Execution. I have verified via dotPeek that all necessary references are included in my merged DLL. After layering in a catch for the LoadException I get the following details:

Method not found: '!0 ♣? .☻?  ()'.
Method not found: '!0 ♣? .☻?  ()'.
Method not found: '!0 ♣? .☻?  ()'.

Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

This is the portion of the code where it breaks:

using (var consolidatedInvoiceExcel = new XLTemplate(templateStream))

XLTemplate being part of the ClosedXML.Report Namespace which is included in my Merged DLLs.

Thank you!

KirillOsenkov commented 2 months ago

any chance I could get a zip file with the repro? and a .cmd file with the command line that calls ilrepack?

will-luna-embark commented 2 months ago

Hi, I unfortunately can't send a zip as is due to too much sensitive data the project interacts with.

If it is helpful I can strip a bunch of my files to exclude the internal app functionality since my problem is coming from utilizing an excel generator.

Let me know if this will be useful.

KirillOsenkov commented 2 months ago

yes, if you create the same situation with a new "ConsoleApp1" project it would be very helpful. Thanks!

will-luna-embark commented 2 months ago

Hello,

Just wanted to follow up here.

My issue has been resolved, part of the problem was removing one of the DLLs I was trying to merge (Aspose.Cells 24.9.0) and make use of an extern alias where my merged DLL was being referenced.

I appreciate your willingness to help out.

Thank you.

KirillOsenkov commented 2 months ago

Glad you figured it out