Reputation: 18171
I have GUI c# project that has several additional packages in reference. I would like to have executable without any additional dll's in build output. For this purpose I'm trying to use ILMerge
package from nuget
. I have just installed package with command:
Install-Package ilmerge -Version 3.0.18
But as result I got same executable that requires dll's. Should I do any configuration in my project in order to make ILMerge
package build merged executable?
Upvotes: 0
Views: 266
Reputation: 1010
I can to propose to you another workaround, which works without any nuget packages, and just required some code:
After this in entrypoint of your app you should do next:
AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
private Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
{
var assemblyName = args.Name.Substring(0, args.Name.IndexOf(','));
var assembly = ...load binary from embeded resources as you wish based on assemblyName...
return Assembly.Load(assembly);
}
profit: no additional packages. Easy to use and debug.
concern: hard to maintance if you have a lot of external packages. Needs to add them manually to Embeded Resources.
Upvotes: 1