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;V3.0.0.0;31bf3856ad364e35;component\themes/aero.normalcolor.xaml”.

StackTrace: Empty

InnerException: None

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.MergedDictionaries>
    <ResourceDictionary Source="/PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml" />
</ResourceDictionary.MergedDictionaries>
To this:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/PresentationFramework.Aero,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
</ResourceDictionary.MergedDictionaries>

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.

posted on Thursday, June 10, 2010 11:47 AM | Filed Under [ Windows Home Server Development ]

Comments

No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Remember me
Please add 6 and 5 and type the answer here:

Search

Site Sections

Recent Posts

Archives

Post Categories

WHS Add-In Tutorial

WHS Blogs

WHS Development