I have a project that was created with VS2008. I'm trying to build it with MSBuild 4.0, but still targeting the 3.5 framework. When I do so, I get the exception:
[exec] ResGen : error RG0000: Could not load referenced assembly "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationUI\v4.0_4.0.0.0__31bf3856ad364e35\PresentationUI.dll". Caught a BadImageFormatException saying "Could not load file or assembly 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationUI\v4.0_4.0.0.0__31bf3856ad364e35\PresentationUI.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.".
Note that it's trying to load the 4.0 version of PresentationUI.dll, even though I'm compiling for the 3.5 framework. It doesn't matter if I convert the project to VS2010 format or not, the error is the same.