WPF: "Unable to find the specified file" (ResourceDictionary)
When trying to reference a cross-project ResourceDictionary, I referenced it within the xaml control that was using it:
<controls:CheckinUserControlView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Dcs.UI.Wpf.Common;Component/Resources/ResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</controls:CheckinUserControlView.Resources>
In Dcs.UI.Wpf.Common project, I also set Resources/ResourceDictionary.xaml build action to "Resource".
Visual Studio 2008 recognized the ResourceDictionary and compliled correctly. However, in Expression Blend, I was getting error "Unable to find the specified file" for the ResourceDictionaries
Then I found this thread.
In short, the solution was to open Dcs.UI.Wpf.Common.csproj in notepad, find the entry for <FileAlignment>, then directly after it, paste:
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Then reload the project in Expression Blend.
EDIT: Soon after I made these changes, the compiler started complaining about "Missing XmlNamespace, Assembly, or ClrNamespace in Mapping instruction", even though my XAML headers contained them. After a lot of trial and error, I changed the ResourceDictionary.xaml build action back to "Page". This resolved the exception and I was able to compile again, but I feared that Blend would again be unable to recognize my ResourceDictionary. But, to my pleasant surprise, Blend also still sees it in design time. Nice!
Unfortunately I don't know why it worked, why it stopped working, why it worked again. But there ya' go...