here is my way to put the dlls in a single exe
1) create a folder named DllsAsResource
and put the MahApps.Metro.dll
and System.Windows.Interactivity.dll
with Add as Link
to it
2) change the Build Action
for the dlls to Embedded Resource
3) change Copy Local
to false
for the normal referenced dlls
4) create Program.cs
using System;
using System.Reflection;
namespace MahApps.Metro.Simple.Demo
{
public class Program
{
[STAThread]
public static void Main()
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
var resourceName = Assembly.GetExecutingAssembly().GetName().Name + ".DllsAsResource." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) {
if (stream != null) {
var assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
}
return null;
};
App.Main();
}
}
}
5) set the Startup object
to the Program.cs
in your project properties
6) now you have a single exe without publishing the hole dlls
you can look at this demo for all the tips
hope that helps