.NET merge class library references
-
13-06-2021 - |
Frage
I have a class library which contains WPF user control. This library has some dependencies but I want to deploy it as one assembly. As I know IlMerge has some problems with WPF. I tried Costura but it works only for applications, not for class libraries (as I have found out here). Is there any way to achieve my goal?
Lösung
As one of the contributors to Costura I can now confirm that it works for libraries as well as applications.
In fact all the unit tests for Costura are on a library, so it definitely works.
Andere Tipps
I know it is already answered, but to fix the loading of assemblies using reflection you can attach the following code in the AssemblyLoad event
var assembly = Assembly.LoadFile(@"<path to your dll>");
var assemblyLoaderType = assembly.GetType("Costura.AssemblyLoader", false);
var attachMethod = assemblyLoaderType?.GetMethod("Attach", BindingFlags.Static | BindingFlags.Public);
attachMethod?.Invoke(null, new object[] { });
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow