Geeks With Blogs

News Blog moved to http://blachniet.com
Brian Lachniet

Okay, so the title may have been a little misleading. I'm not going to show you how to avoid warning CA0060, but how to avoid your build failing because of this warning.

This is only helpful if you are running FxCop as a Post-build Event. When FxCop fails due to its inability to find indirectly referenced assemblies, it exits with error code 512 (0x200 - Assembly Reference Error). So all you need to do is check that error code, send out a simple warning message, and reset the error code to 0. The following can be placed directly into the Post-build event field in your project's properties.

<YOUR FXCOP COMMAND>
IF 512 == %ERRORLEVEL% (
echo postbuildevent:fxcop warning FXCOP:FxCopCode analysis was unable to complete.
SET ERRORLEVEL = 0
)

The echo is formatted so that the warning will show up in Visual Studio's Error List. See my other post for more info on how that formatting works here.

Posted on Tuesday, July 12, 2011 1:29 AM Visual Studio , FxCop | Back to top


Comments on this post: Avoiding FxCop Warning CA0060

# re: Avoiding FxCop Warning CA0060
Requesting Gravatar...
Yes, I also am looking forward to the demos you promised. I think they are very informative and a lot of information and tips are shared to this kind of knowledge sharing tools. - Joe Zanotti
Left by Joe Zanotti on Jan 07, 2012 12:07 AM

Your comment:
 (will show your gravatar)


Copyright © blachniet | Powered by: GeeksWithBlogs.net