I have a merged resource dictionary in App.xaml
Main assembly, which combines various resource dictionaries from separate assemblies: Common and PresentationLayer.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Common;component/Themes/Button.xaml"/>
<ResourceDictionary Source="/PresentationLayer;component/DataTemplates/AppointmentsDataTemplates.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
At run time the styles in the resource dictionaries are applied to the controls correctly. However, at design time the styles are not applied and Visual Studio 2012 keeps giving the following error:
An error occurred while finding the resource dictionary "/Common;component/Themes/Button.xaml".
And warning:
The resource "BannerButton" could not be resolved.
I came across this post but the problem persists despite Build Action set to Resource. Also, I did not have this problem when running under Visual Studio 2010 or Expression Blend 4. The Main assembly definitely holds a reference to the Common assembly and I haven't changed the Pack URIs.
This was a known issue with Visual Studio 2012. See this link at Microsoft Connect. After installing VS2012 Update 1 this issue resolved for me. If you think you're running the most up to date version of VS2012 and still experiencing this issue, make absolutely sure that the update has been applied. I thought I had updated using Windows Update, but then found that I had to tell VS2012 to apply the update. After VS2012 did its thing everything was fine.
For VS2017 if assembly is referenced and double-checked that all namings are OK try to close VS and delete .vs
directory in solution directory. This will cause you to lose all user settings (startup project, WPF designer zoom, etc.) but will fix this.
If you are using Visual Studio 2017, try to restart your computer. The problem may be solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With