Work around double quotes bug

I'm trying to get the FxCop running up and working. Everything works fine from the command line. But in my build step I need to pass a rules set directory to FxCop as a an Additional FxCopCmd options. The directory has a space in its name (its below the default install directory for Visual Studio).

Entering it without quotes
/ruleset:=directory with space
gives

[10:41:50][Step 1/1] Starting: "[...]\FxCopCmd.exe" /ruleset:=directory with space
[10:41:51][Step 1/1] Argument specified without a corresponding switch : 'with'.
[10:41:51][Step 1/1] Argument specified without a corresponding switch : 'space'.
[10:41:51][Step 1/1] Process exited with code 128
[10:41:51][Step 1/1] FxCop return code (128): COMMAND_LINE_SWITCH_ERROR


Entering it with quotes
/ruleset:="directory with space"
gives

[10:49:54][Step 1/1] Starting: "[...]FxCopCmd.exe" "/ruleset:="directory with space""
[10:49:54][Step 1/1] Argument specified without a corresponding switch : 'with'.
[10:49:54][Step 1/1] Argument specified without a corresponding switch : 'space'.
[10:49:54][Step 1/1] Process exited with code 128
[10:49:54][Step 1/1] FxCop return code (128): COMMAND_LINE_SWITCH_ERROR


(please note the extra quotes, that I did not provide).

Some search gives me that this is in fact a known critical bug from 2009 (!), that does not appear to have been fixed yet. :(
https://youtrack.jetbrains.com/issue/TW-7964

Any ideas how to work around this?
3 comments

Uhm, how do I edit my question? I want to improve the formatting (since there was no preview available).

0

Hi Magnus,

As workaround you can run FxCop from the script (using Command Line Runner) and use service message to import generated xml:

##teamcity[importData type='FxCop'
 
path='<path to the xml file>']

For more details see: https://confluence.jetbrains.com/display/TCD9/FxCop#FxCop-FxCopServiceMessages.
Sorry for the inconvenience.

0

Or you could create a symbolic link without spaces e.g:

C:\> mklink /d fxcoprulesets "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets"
0

Please sign in to leave a comment.