views:

819

answers:

4

Any ideas as to how to make this error message go away?

Cannot run process E:\Program Files\Microsoft FxCop 1.36\FxCop.exe\FxCopCmd.exe /forceoutput /gac /ignoregeneratedcode /f:\Sacog\bin\Debug\Sacog.dll /out:05A1B22A-DE6E-49ae-AA30-DC52A074EF22\fxcop-result.xml : file not found

A: 

FxCop is attempting to test code at the ROOT of the BuildAgent's drive... the switch

/f:\Sacog\bin\Debug\Sacog.dll

Is trying to get Sacog.dll from the root of that drive. This is probably from the list of files that you have configured in TeamCity for FxCop to analyze. Remove the \ at the beginning of the file name in the "Assemblies" section on the "Build Configuration / Step 3: Runner" configuration screen.

Jeff Fritz
Tried your suggestion, still no joy. This is what is in the assemblies section:Sacog\bin\Debug\Sacog.dll
KevDog
I'm grasping at straws here, but could the spaces in the path to FxCop be a problem?
KevDog
A: 

Just add the FXCop path to the PATH environment variable.

Also, NAnt contrib has a fxcop task. Use it like so:

  <loadtasks>
    <fileset basedir="${environment::get-variable('NAntContribHome')}">
      <include name="NAnt.Contrib.Tasks.dll" />
    </fileset>
  </loadtasks>


  <target name="fxCop" depends="compile">
    <fxcop analysisReportFilename="fxCopResults.xml" failOnAnalysisError="false" >
      <targets>
        <includes name="BinaryToAnalyse.dll" />
      </targets>
      <rules>
        <includes name="C:\Program Files\Microsoft FxCop 1.36\Rules\*Rules.dll" />
      </rules>
    </fxcop>
  </target>
MPritch
Just re-read your question. Are you using the in-build TC runner, or invoking via NAnt?
MPritch
For now I am using the TC runner but I am open to change, I'm trying to level up on MSBuild or NAnt to get more long-term flexibility.
KevDog
A: 

Have you set "FxCop installation root" setting in the runner configuration?

If you have, please remove FxCop.exe from the end.

If not, could you post here the content of Settings tab from your FxCop build page?

shalupov
As for NAnt/MSBuild integration, see http://www.jetbrains.net/confluence/display/TCD4/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingFxCop
shalupov
+3  A: 

I had to set the following in buildAgent.properties file

system.FxCopRoot=c\:\\Program Files (x86)\\Microsoft FxCop 1.36

Make sure to escape the colon and backslashes.

Then I had to create an artifact from my compile build configuration of the bin folder containing the assemblies I wanted FxCop to look at. Then I had to create an artifact dependency on that artifact in the FxCop build configuration; otherwise there were not any assemblies available for FxCop tp operate on.

That did the trick for me.

wizardbyte