I’ve been meaning to write this post ever since David and I came across this error after we installed the new PostSharp RC3 released a few weeks ago. After building a project and running code analysis on it, we received the following error: “CA0055 : * Could not load file: ‘@(IntermediateAssembly->’obj\Debug\Before-PostSharp\ExtendHealth.Utilities.dll’.” After a little digging, we found a small typo in the latest .targets file included in the PostSharp install. A couple characters are missing from line 186 of PostSharp-1.0.targets:
The ‘ and ) in red above were missing. After we fixed the typo, code analysis worked perfectly. This typo has been fixed in the latest daily build (22.214.171.1247), but that build was emitting invalid IL and causing InvalidProgramExceptions to be thrown. It’s simple to fix, so we’ve just remembered to do it on each machine using the latest release candidate. The default location of the targets file is “%ProgramFiles%\PostSharp 1.0”.
NOTE: If running Vista, be sure to run the text editor with administrative privileges to update the file.