How to remove the /aspnet parameter from FxCopCmd (error CA0001)

455 views Asked by At

I'm trying to use FxCop on SonarQube 4.5.1, but the FxCopCmd is failing.

The problem is, when SonarQube creates the FxCopCmd call, he adds the parameter /aspnet. Since my program is a Web Project and not a Web Site, this parameter is causing 4 analysis engire exceptions:

C:\Program Files\Microsoft Fxcop 10.0>FxCopCmd.exe /file:G:\sbs1\workspace\Projeto2\DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ruleset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /forceoutput /searchgac /aspnet

Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
Copyright (C) Microsoft Corporation, All Rights Reserved.

Loaded designrules.dll...
Loaded globalizationrules.dll...
Loaded interoperabilityrules.dll...
Loaded mobilityrules.dll...
Loaded namingrules.dll...
Loaded performancerules.dll...
Loaded portabilityrules.dll...
Loaded securityrules.dll...
Loaded securitytransparencyrules.dll...
Loaded usagerules.dll...
Loaded DCX.ITLC.Web.dll...
Initializing Introspection engine...
An unhandled exception was encountered during GlobalBeforeAnalysis:
...
Analysis Complete.
* 4 total analysis engine exceptions.
Writing report to G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.
ITLC.Web\fxcop-report.xml...
Done:00:00:01.4219205

If I execute the same call without the /aspnet parameter, FxCopCmd runs fine:

C:\Program Files\Microsoft Fxcop 10.0>FxCopCmd.exe /file:G:\sbs1\workspace\Projeto2\DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ruleset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /forceoutput /searchgac

Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
Copyright (C) Microsoft Corporation, All Rights Reserved.

Loaded designrules.dll...
Loaded globalizationrules.dll...
Loaded interoperabilityrules.dll...
Loaded mobilityrules.dll...
Loaded namingrules.dll...
Loaded performancerules.dll...
Loaded portabilityrules.dll...
Loaded securityrules.dll...
Loaded securitytransparencyrules.dll...
Loaded usagerules.dll...
Loaded DCX.ITLC.Web.dll...
Initializing Introspection engine...
Analyzing...
Analysis Complete.
Writing report to G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml...
Done:00:00:02.2656975

The components that I'm using are: - SonarQube 4.5.1 - Analysis Bootstrapper for Visual Studio Projects 1.2 - C# 3.3

I'd love to find a way to disable the use of the /aspnet parameter on SonarQube. Any help will be greatly appreciated.

1

There are 1 answers

2
Dinesh Bolkensteyn On BEST ANSWER

Indeed FxCop 10 has some troubles with the /aspnet switch. FxCop version 12 (which is bundled with Visual Studio 2013) properly handles that switch.

The issue you are describing is a known issue, which has not yet been fixed as of today, but for which there is a ticket: http://jira.codehaus.org/browse/SONARVS-62

In the very short term, you could create a wrapper around FxCopCmd.exe to strip the flag.