1

I am having an issue merging a ResourceDictionary that is in a referenced dll.

Here is my setup:

I am using Visual Studio 2012 with the latest updates.

In one solution, I have a project called Utils which contains a ResourceDictionary called Styles.xaml. The build action is set to Page. Here is a snippet of what it looks like:

Styles.xaml ResourceDictionary

In another solution, I have an application project which references Utils.dll. In my App.xaml file, I'm trying to merge the Styles.xaml dictionary in Utils. Here is that snippet:

App.xaml

The error that I'm getting when trying to merge this dictionary is An error occurred while finding the resource dictionary "/Utils;component/WPFStyles/Styles.xaml".

I've tried changing the Source to be Source="pack://application:,,,/Utils;component/WPFStyles/Styles.xaml" but that didn't help.

I've also tried changing the build action to Resource, which gave me no luck either.

The odd thing about this (at least I think it's odd) is that I have no problem merging the ResourceDictionary when I have the Utils project referenced in another project in the same solution. This problem only occurs when I try to reference Utils.dll in another solution.

If anyone has any ideas, I would really really appreciate it because I'm running out of things to try.

Just Ask
  • 329
  • 2
  • 6
  • 22
  • Does it fail on build? – Glen Thomas Apr 02 '16 at 23:56
  • No, the build succeeds. – Just Ask Apr 02 '16 at 23:58
  • Its a Visual Studio issue, not much you can do about it. Your application works fine though? – Glen Thomas Apr 03 '16 at 00:03
  • Yeah, it seems to work fine. It's just pretty frustrating that I can't see the styles of my windows and controls in my design view. Would you happen to know if later versions of Visual Studio have this issue fixed, or if Microsoft is working on a fix? – Just Ask Apr 03 '16 at 00:13
  • Possible duplicate of [Unable to merge ResourceDictionary from a referenced project](http://stackoverflow.com/questions/12430762/unable-to-merge-resourcedictionary-from-a-referenced-project) – Glen Thomas Apr 03 '16 at 00:16
  • Possible duplicate of [An error occurred while finding the resource dictionary](http://stackoverflow.com/questions/14392782/an-error-occurred-while-finding-the-resource-dictionary) – Glen Thomas Apr 03 '16 at 00:20
  • Possible duplicate of [Error finding merged resource dictionary in another assembly](http://stackoverflow.com/questions/6268979/error-finding-merged-resource-dictionary-in-another-assembly) – Glen Thomas Apr 03 '16 at 00:22
  • There are a number of ways VS can get this wrong, but first thing to do is to make 100% sure your VS2012 is up-to-date. As the second link @Glen proposes, there was a known issue in VS2012 which was fixed by one of the updates to that version. All else fails, you can always "Add Existing..." with the project in question to pull it into your Solution (since projects from the same solution work fine for you). – Peter Duniho Apr 03 '16 at 02:07
  • FWIW: I tested this scenario in VS2013 and it works fine. I can add a reference to the DLL, without the project being part of my main project's solution, then include the dictionary in the `MergedDictionaries` of the main application dictionary, and there are no design-time errors, and the resources are applied as expected in the Designer. I can't tell you which specific issue you're having; there's not enough information in your question to determine that. But I can tell you that once you have updated VS and have fixed any other config issues, this will work for you. – Peter Duniho Apr 03 '16 at 04:30
  • Are your projects all built under the same version? – AzzamAziz Apr 03 '16 at 04:48

0 Answers0