Wednesday, October 17, 2012

Compiling Moles Projects After VS2010 SP1 Update

If you have a Visual Studio 2010 project that uses the Moles framework, you may be getting an error similar to this when you try to compile:

The type or namespace name 'XXXXXXXXXXX' does not exist in the namespace 'YYYYYYYYYY' (are you missing an assembly reference?)

This is due to the fact that Windows stores the assembly that you have moled in two different places. The SP1 update for Visual Studio 2010 updated one of these assemblies, but not the other. The simplest fix is to replace the old assembly with a copy of the new assembly (make a backup first).

The old assembly should be in:

"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"

While the new assembly should be in: