I've found a bug in VS2010, regarding solutions that reference multiple projects in which you have at least one WPF control library.
When you open the WPF designer, the DLL's referenced by the project are locked. Therefore, trying to compile will issue that error.
If this is the scenario you are suffering, there's no solution AFAIK, but as workaround:
1. Make sure to close ALL the WPF open designers
2. Make a rebuild all, then clean solution, then build again. This works most of the time
Or, open the XAML files in XML editor in VS2010, so the designer is not loaded. I usually write XAML directly. If you have to write a more complex XAML, then open Blend side-by-side with VS2010, so you edit XAML in Blend and compile and debug in VS2010.