How to remove baml from WPF assembly?

633 Views Asked by At

Using the merged resource dictionaries degrade application performance. In my assembly I often need to use merged resource dictionaries. I want to combine resources in one dictionary, and delete the original baml. I can't set Build Action to None (instead of Page), because in this case I lose some functionality (e.g., no syntax highlighting by resharper). How can I do this?

1

There are 1 best solutions below

5
gliderkite On

At run-time your application still need to read the linked BAML resources files, for this reason you can't remove BAML from your assembly.

For example:

You merge the following resource dictionaries

  • dictionary1.xaml
  • dictionary2.xaml

in merged.xaml.

You cannot simply remove the compiled XAML (BAML - dictionary1.baml and dictionary2.baml), because, as I wrote, at run-time you still need these resources.

But, anyway, you could literally copy the content of your XAML resources on merged.xaml, in this way you will have only merged.baml (after the compiler has generated it in your assembly resource part).