1

我需要运行我在 NAnt 构建文件中实现的 FxCop 属性。我有 NAnt 和 NAntContrib。我已将内容复制nantcontrib\bin到 nant\bin 文件夹并将环境变量设置为FxCopCmd.exe.

然后当我运行 NAnt 脚本时出现错误:

无效属性 (fxcop)

可能是什么问题呢?

4

1 回答 1

1

It's a bit simpler to invoke FxCop directly from NAnt, without using the NAntContrib task, by using NAnt's exec task. For implementation details, have a look at an article I wrote about integrating NAnt and FxCop.

Here's the code:

<!-- specify location of required tools -->
<property name="dir.tools" value="tools" />

<!-- analyze build for code quality -->
<target name="analyze.fxcop" depends="build" description="Analyze generated code using FxCop"> 
    <!-- specify location of input and output files -->
    <property name="fxcop.input" value="wadmt.fxcop" />
    <property name="fxcop.output" value="${dir.build}fxcop-results.xml" /> 

    <!-- send the analysis work to the FxCop command-line tool -->
    <exec program="${dir.tools}fxcopFxCopCmd.exe" failonerror="false">
        <arg value="/project:${fxcop.input}" /> <!-- use the fxcop project file -->
        <arg value="/forceoutput" /> <!-- create output even if no violations are found -->
        <arg value="/summary" /> <!-- show some summary info -->
        <arg value="/out:${fxcop.output}" /> <!-- specify an output file -->
    </exec>
</target>
于 2010-03-26T00:39:50.197 回答