I heart WPF in Visual Studio because it’s incredibly easy to separate business logic from the user interface. However, I don’t really heart the Visual Studio WPF designer.
Expression Blend 4 is out now, so I just loaded up our latest secret Windows Home Server Add-In project (it’s WPF, did I mention how much I love WPF?). And I was greeted with this lovely error message:
Exception: An error occurred while finding the resource dictionary “/PresentationFramework.Aero;V22.214.171.124;31bf3856ad364e35;component\themes/aero.normalcolor.xaml”.
Which is helpful. Obviously, we’re forcing WPF to use the Aero theme (because Windows Home Server is based on Windows Server 2003, and the default theme is horrid), and Expression Blend is having issues finding that theme file. It works fine in Visual Studio and at runtime, but not in Expression Blend.
The solution is to
stop specifying the specific version of the use syntax that Expression Blend understands, and to add an explicit reference in the project to PresentationFramework.Aero.dll.
We go from this:
<ResourceDictionary Source="/PresentationFramework.Aero;V126.96.36.199;31bf3856ad364e35;component/themes/aero.normalcolor.xaml" />
<ResourceDictionary Source="/PresentationFramework.Aero,Version=188.8.131.52,Culture=neutral,PublicKeyToken=31bf3856ad364e35,ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
And everyone is happy.
Edit: Actually, everyone was not happy. The Add-In threw some nasty exceptions when I loaded it up with the version number removed. The solution has been amended above.