PostSharp RC3 MSBuild/Code Analysis error

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:

<CreateProperty Value=”@(IntermediateAssembly->’$(_PostSharpInputBin)‘)“>

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 (1.0.9.377), 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.

Advertisements

One thought on “PostSharp RC3 MSBuild/Code Analysis error

  1. I love PostSharp! It works really well with the new Asp.net MVC framework. I use it to add all sorts of ‘aspects’ to my controllers and stuff.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s