0

I'm having problems getting the FxCop command line to work when I specify paths with spaces in them. Yes, I use the quotes properly.

M:\build\IOService\src>"c:\Program Files\Microsoft FxCop 1.36\FxCopCmd.exe" /c /f:".\My Library\bin\Release\" /r:"c:\Program Files\Microsoft FxCop 1.36\Rules\"
Microsoft (R) FxCop Command-Line Tool, Version 1.36 (9.0.30729.1)
Copyright (C) 2007 Microsoft Corporation.  All rights reserved.

Argument specified without a corresponding switch : 'Files\Microsoft'.
Argument specified without a corresponding switch : 'FxCop'.
Argument specified without a corresponding switch : '1.36\Rules"'.

Type FxCopCmd.exe /? for help on command-line arguments.

FxCop complains about the path passed to the /r switch. I am quoting the path per the FxCop guidance. This also happens when I pass paths via the /d switch. Has anyone else had similar problems? It doesn't matter if I use cmd or PowerShell.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
rev
  • 1,681
  • 2
  • 13
  • 21

3 Answers3

1

Remove the trailing slash on the rule switch fixes this issue (even in FX Cop 10.0)

Change:

/r:"c:\Program Files\Microsoft FxCop 1.36\Rules\"

To:

/r:"c:\Program Files\Microsoft FxCop 1.36\Rules"
Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
DoubleJ
  • 419
  • 6
  • 7
0

Have you tried accessing via old 8.3 filenames?

eg

"c:\Progra~1\Micros~1\FxCopCmd.exe" /c /f:".\MyLibr~1\bin\Release\" /r:"c:\Progra~1\Micros~1\Rules\"

No guarantees that it will work as expected, but might be worth a go. :)

--edit-- I know it shouldn't need to use 8.3 names. It is a recent tool so should be more than capable of taking long names, but since it giving trouble this might be a starting point rather than a full solution. --end edit--

ZombieSheep
  • 29,603
  • 12
  • 67
  • 114
  • well, i could do that on the command line, but i'm trying to get the visual studio integration to work and i'm passing things like /d:$(SolutionDir) which expands out to a quoted path with long names. – rev Nov 11 '09 at 14:39
0

I had this problem when executing FXCop tasks from msbuild. It was creating the command line arguments with a similar pattern.

I got rid of this error by removing a flag: /d:".\"

It looks suspiciously like your /f:".\MyLibr~1\bin\Release\" argument. Perhaps fxcop chokes on the ".\" and thinks everything after is no longer quoted? Try changing this to /f:"MyLibr~1\bin\Release\" and see if that fixes it.

~Loren

Pickles
  • 1,270
  • 2
  • 11
  • 20