Experiences with C# integration with recent improvements / issues running

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Experiences with C# integration with recent improvements / issues running

mattadamson

Team,

 

We’re trying to get a C# project analysed with Sonar 4.52 and having some issues with the following configuration

 

Jenkins version:  1.592

Java: 1.70

Server: Windows 2008 R2

Sonar runner: 2.3 and 2.4

MSTest: from vs2012

Resharper: Command line tools

Solution: C#, .NET 4.5/.NET 4.0

 

This is our current process

 

Jenkins:

-Pull source from Git

-Build single SLN using plugin for MSbuild with settings:

/p:Configuration=Release /filelogger /consoleloggerparameters:Summary /v:n /t:rebuild /p:RunCodeAnalysis=true

(please note project files do not have code analysis set in project file, we do that via command line parameter)

-Run command line:

(to create Resharper XML report)

E:\Downloads\resharper\ReSharperCommandLineTools01Update1\inspectcode.exe "%WORKSPACE%\product 123\Server\product123.sln" /o="%WORKSPACE%\resharper-results.xml"

-Invoke standalone sonar analysis:

 

We are trying both resharper and FXcop combinations to get this to work e.g.

 

# Project identification

sonar.projectKey=com.xxxxxxx.name1:name1

sonar.projectVersion=1.0-SNAPSHOT

sonar.projectName=name1

 

sonar.sources=.

sonar.language=cs

#sonar.dotnet.key.generation.strategy=safe

 

sonar.sourceEncoding=UTF-8

 

#sonar.visualstudio.enable=false

 

#sonar.analysis.mode=incremental

sonar.fxcop.mode=skip

sonar.gendarme.mode=skip

sonar.stylecop.mode=skip

 

#sonar.resharper.mode=reuseReport

#sonar.resharper.reports.path=%WORKSPACE%/resharper-results.xml

#sonar.resharper.includeAllFiles=false

 

sonar.dotnet.visualstudio.solution.file=product123/Server/product123.sln

#sonar.visualstudio.enable=false

 

# FXCop 

sonar.fxcop.installDirectory=C:/Program Files (x86)/Microsoft Visual Studio 11.0/Team Tools/Static Analysis Tools/FxCop

#sonar.fxcop.assemblyDependencyDirectories=/bin/Release

sonar.cs.fxcop.fxCopCmdPath=C:/Program Files (x86)/Microsoft Visual Studio 11.0/Team Tools/Static Analysis Tools/FxCop/FxCopCmd.exe

 

In the sonar Jenkins log we see this

 

ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
ERROR: 
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure

 

Fxcop works fine on the Jenkins server (as I use it during full product build), Jenkins will yield Fxcop report (TRX file). I tried turning off visual studio enable to false. I’ve tried manually listing assemblies in config file. Etc.

 

Appreciate your thoughts

 

Many thanks

 

Matt

 

Reply | Threaded
Open this post in threaded view
|

Re: Experiences with C# integration with recent improvements / issues running

Dinesh Bolkensteyn-2
Hi Matt,

It seems that your configuration file contains a mix of directives for the new C# 3.x and the format C# 2.x plugins.

Please check out the documentation and examples for the latest C# 3.x plugin version only:

This version will drive the FxCop and R# executions by itself (meaning that FxCop will be relaunched, if it already was executed by MSBuild through /p:RunCodeAnalysis=true)

Kind regards,




On Fri, Mar 6, 2015 at 4:34 PM, Adamson, Matthew <[hidden email]> wrote:

Team,

 

We’re trying to get a C# project analysed with Sonar 4.52 and having some issues with the following configuration

 

Jenkins version:  1.592

Java: 1.70

Server: Windows 2008 R2

Sonar runner: 2.3 and 2.4

MSTest: from vs2012

Resharper: Command line tools

Solution: C#, .NET 4.5/.NET 4.0

 

This is our current process

 

Jenkins:

-Pull source from Git

-Build single SLN using plugin for MSbuild with settings:

/p:Configuration=Release /filelogger /consoleloggerparameters:Summary /v:n /t:rebuild /p:RunCodeAnalysis=true

(please note project files do not have code analysis set in project file, we do that via command line parameter)

-Run command line:

(to create Resharper XML report)

E:\Downloads\resharper\ReSharperCommandLineTools01Update1\inspectcode.exe "%WORKSPACE%\product 123\Server\product123.sln" /o="%WORKSPACE%\resharper-results.xml"

-Invoke standalone sonar analysis:

 

We are trying both resharper and FXcop combinations to get this to work e.g.

 

# Project identification

sonar.projectKey=com.xxxxxxx.name1:name1

sonar.projectVersion=1.0-SNAPSHOT

sonar.projectName=name1

 

sonar.sources=.

sonar.language=cs

#sonar.dotnet.key.generation.strategy=safe

 

sonar.sourceEncoding=UTF-8

 

#sonar.visualstudio.enable=false

 

#sonar.analysis.mode=incremental

sonar.fxcop.mode=skip

sonar.gendarme.mode=skip

sonar.stylecop.mode=skip

 

#sonar.resharper.mode=reuseReport

#sonar.resharper.reports.path=%WORKSPACE%/resharper-results.xml

#sonar.resharper.includeAllFiles=false

 

sonar.dotnet.visualstudio.solution.file=product123/Server/product123.sln

#sonar.visualstudio.enable=false

 

# FXCop 

sonar.fxcop.installDirectory=C:/Program Files (x86)/Microsoft Visual Studio 11.0/Team Tools/Static Analysis Tools/FxCop

#sonar.fxcop.assemblyDependencyDirectories=/bin/Release

sonar.cs.fxcop.fxCopCmdPath=C:/Program Files (x86)/Microsoft Visual Studio 11.0/Team Tools/Static Analysis Tools/FxCop/FxCopCmd.exe

 

In the sonar Jenkins log we see this

 

ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
ERROR: 
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure

 

Fxcop works fine on the Jenkins server (as I use it during full product build), Jenkins will yield Fxcop report (TRX file). I tried turning off visual studio enable to false. I’ve tried manually listing assemblies in config file. Etc.

 

Appreciate your thoughts

 

Many thanks

 

Matt