开发者

FxCop command line and paths with spaces

开发者 https://www.devze.com 2022-12-11 17:00 出处:网络
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.

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.


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"


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--


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

0

精彩评论

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