How to combine WPF application builds?

I tried using ILMerge in my WPF based project (VS2010, Net4.0), but I was not able to run the merged executable. So I created two very simple projects

  • just a console application that prints hello world
  • wpf application that shows a window with the hello world shortcut

After compiling each project, I get one executable file (so merging doesnโ€™t merge anything, itโ€™s just for the test). Of course, every executable works.

Then I merge each executable as follows:

"C:\Program Files\Microsoft\ILMerge\ilmerge" /targetplatform:v4,c:\Windows\Microsoft.NET\Framework\v4.0.30319 /lib:c:\Windows\Microsoft.NET\Framework\v4.0.30319\wpf /out:Merged.exe MyApplication.exe 

(I made a multiline read-only SO call). So, now the console application integrates and works as well as before, the wpf application integrates without any errors, but I can not start it. I mean, I type

 Merged.exe 

The taskbar blinks, but nothing is displayed - there is no window, no error, nothing.

So how do I combine a WPF application?

+4
source share
2 answers

From what I know (and experienced), ilmerge does not work correctly with WPF builds that have xaml resources built into.

See this question for some possible solutions / alternatives.

+2
source

If I understand correctly, you want to embed all the assemblies in one exe.

There is an amazing NuGet package called Costura.Fody . Merging assemblies couldn't be easier!

If you need to combine resource DLLs, you're in luck! There is another NuGet that extends Costura.Fody called Resource.Embedder !

0
source

All Articles