-1

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?

Aleksandr Vishnyakov
  • 1,872
  • 5
  • 23
  • 39

1 Answers1

1

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).

gliderkite
  • 8,828
  • 6
  • 44
  • 80
  • I already copy the content from my dictionaries to merged.xml file, but I don't want delete dictionary1.xaml and dictionary2.xaml files, but I need to it, because otherwise compiler will generate dictionary1.baml and dictionary2.baml. Can I delete dictionary1.baml and dictionary2.baml manually? – Aleksandr Vishnyakov Jun 22 '12 at 11:47
  • Yes, you can delete these files, as you can delete any other files not protected or used by another process (if you use VS you can usually find them under `obj` directory), **but**, as I wrote, these files are needed for your application. – gliderkite Jun 22 '12 at 12:50
  • No, these files no needed for my application. merged.xaml already contains all data of dictionary1.xaml and dictionary2.xaml, because I COPY data from dictionary1.xaml and dictionary2.xaml to merged.xaml. I DON'T use ResourceDictionary.MergedDictionary property. – Aleksandr Vishnyakov Jun 22 '12 at 15:29
  • Thus remove the dictionaries if you want or at most set their build action to `None`. – gliderkite Jun 22 '12 at 15:36
  • I don't want set Build Action to None (instead of Page), because in this case I lose some functionality (e.g., no syntax highlighting by Resharper). – Aleksandr Vishnyakov Jun 22 '12 at 16:12