none
ILMerge problem because of XamlGeneratedNamespace

    Question

  • I am trying to use ILMerge to merge several assemblies, but I get an error because of a duplicate type:

     

        XamlGeneratedNamespace.GeneratedInternalTypeHelper

     

    This is because two assemblies use WPF.

     

    Is there any way to specify the namespace used for the generated GeneratedInternalTypeHelper.g.cs file?  Or am I out of luck using ILMerge with multiple WPF assemblies?

     

    -Larry

     

     

    Wednesday, April 23, 2008 8:32 PM

Answers

  • Hi Lawrence,

    Unfortunately that namespace generated by XAML compiler is hard coded, and you cannot change it in current version of WPF, one possible way to change the auto-generated namespace is to use ildasm to disassembly the assembly, dump it into IL file, and change the namespace in IL code, and then recompile it using ilasm.exe IL compiler.

    Hope this helps
    Tuesday, April 29, 2008 9:57 AM

All replies

  • Is there another forum I should post this question on?

     

    Friday, April 25, 2008 4:54 PM
  • Hi Lawrence,

    Unfortunately that namespace generated by XAML compiler is hard coded, and you cannot change it in current version of WPF, one possible way to change the auto-generated namespace is to use ildasm to disassembly the assembly, dump it into IL file, and change the namespace in IL code, and then recompile it using ilasm.exe IL compiler.

    Hope this helps
    Tuesday, April 29, 2008 9:57 AM
  • Hi Marco,

     

    Thanks for the reply and for the workaround.

     

    Please consider a fix for this in a future WPF release.  It would make things easier.

     

    Thanks!

    -Larry

     

    Tuesday, April 29, 2008 3:43 PM
  • You could use something like RummageTypeRenamer which I’ve been using with great success for exactly this purpose. I have a call to RummageTypeRenamer in all of my build scripts which renames GeneratedInternalTypeHelper (if it exists) to GeneratedInternalTypeHelper$(ProjectName), making it unique across projects and thus allowing me to use ILMerge on any combination of project+library.

    I found it via this blog entry so it would only be fair if I link to this as well.

    Thursday, October 04, 2012 4:55 PM