开发者

running FxCop in NAnt on VS 2010 project

开发者 https://www.devze.com 2023-04-09 05:41 出处:网络
I\'m trying to set up a CI tool using NAnt. I have managed to have NAnt build the project I\'ve created the .FxCop file for the project, but when I inserted the FxCop commands in the Nant Build config

I'm trying to set up a CI tool using NAnt. I have managed to have NAnt build the project I've created the .FxCop file for the project, but when I inserted the FxCop commands in the Nant Build configuration, I received

[exec] Loading C:\projects\BuildingSolution\BuildingSolution.FxCop...
[exec] Failed loading FxCop project.
[exec] Error text: Project version is incompatible with current application version..

the project and solution is made from Visual Studio 2010 on .NET 4.0 NAnt version is 0.91-alpha2 FxCop version is 10

The settings that I inserted:

<target name="runFxCop">
<exec program="c:\devtools\fxcop10\fxcopcmd.exe" 
   commandline="/p:${FxCop.Filename}  /o:${Build.OutputFolder}Latest\fxcop-results.xml" 
   failonerror="false"/>
</target>

The error message says that the project is not supported, but I've seen posts that talks about FxCop supporting .Net 4.0. I'm not sure wh开发者_如何学JAVAether I'm configuring it wrong or it's not supported at the moment. Can anyone help me with this?


Try setting the nant.settings.currentframework property like this:

<property name="nant.settings.currentframework" value="net-4.0" />


Ditto @TrueWill - try to get it running via the command line to ensure it works, then integrate it into your nant scripts.

However I have chosen an alternative method of running this analysis for my projects as the FxCop command line runner produces different results than the IDE Code Analysis runner (namely because FxCop doesn't support the new phoenix engine), and I wanted the build server to enforce the same rules as were run in the IDE.

I used the process as described in this blog to set up my environment. This also gave me the ability to relax the rules for my unit test projects. When the build task is run, the code analysis results are written to a CodeAnalysisLog.xml file for each project. My CI server then simply checks these logs for the report.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号