How do I fix the inexplicable 'Item has already been added' errors with resource dictionaries in WPF?

Occasionally when developing WPF applications you may experience an inexplicable error regarding duplicate keys in a ResourceDictionary. The wording for the error will be something like the following:

Error at element 'ResourceDictionary' in markup file 'Window1.xaml' : Item has already been added. Key in dictionary: 'MyItemKey'  Key being added: 'MyItemKey'.

This is a perfectly valid error message if you are actually adding a second item to a dictionary with a key that has already been used. What makes this error confusing is that it can occur in simple applications when there are obviously no duplicates in the dictionary in question. The error occurs at run-time, but seems to be caused by some bug in the WPF build process. The problem can be worked around in a number of cumbersome ways such as re-naming the single resource in question, or copying files into a new project. The recommended way to solve this problem is to select 'Clean' from the build menu and then re-build your application. This problem has been noted in versions of WPF including the current Feb 2006 CTP. Hopefully this issue will be resolved as WPF approaches its final release.

Performing a Clean from the VS context menu