English 中文(简体)
FxCop command line and paths with spaces
原标题:
  • 时间:2009-11-11 14:15:15
  •  标签:
  • .net
  • fxcop

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:uildIOServicesrc>"c:Program FilesMicrosoft FxCop 1.36FxCopCmd.exe" /c /f:".My LibraryinRelease" /r:"c:Program FilesMicrosoft FxCop 1.36Rules"
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 :  FilesMicrosoft .
Argument specified without a corresponding switch :  FxCop .
Argument specified without a corresponding switch :  1.36Rules" .

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 FilesMicrosoft FxCop 1.36Rules"

To:

/r:"c:Program FilesMicrosoft FxCop 1.36Rules"

Have you tried accessing via old 8.3 filenames?

eg

"c:Progra~1Micros~1FxCopCmd.exe" /c /f:".MyLibr~1inRelease" /r:"c:Progra~1Micros~1Rules"

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~1inRelease" argument. Perhaps fxcop chokes on the "." and thinks everything after is no longer quoted? Try changing this to /f:"MyLibr~1inRelease" and see if that fixes it.

~Loren





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签