Sonar Integration with TFS build for .net projects
This document provides details about TFS and Sonar integration for .Net projects. The .net projects can be analyzed using solution properties or adding invoke process in the build process template.
Pre-requisites:
Sonar media download link.
http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Ant+Task
Installing Sonar.
1.Download sonar-3.7 and sonar-runner-2.3*** unzip folders and copy the contents in c drive.
2.Run StartSonar bat files. from :-> sonar-3.7
3. Download sonar plug-in for .net from the below link:
http://docs.codehaus.org/display/SONAR/C+Ecosystem
Download and copy .jar files to “C:sonar-3.7extensionsplug-ins” and start sonar runner.
The below steps describes both the procedures:
Using Solution Properties
1. Define sonar-project.properties for you project.
sonar.projectKey=com.mycompany:myCSharpApplication
sonar.projectVersion=1.0-SNAPSHOT
sonar.projectName=My CSHARP Application
# Info required for SonarQube
sonar.sources=. # Always set it this way even if this property is not used
sonar.language=cs
2. Add below line of snippets for post build event
3. C:sonar-runner-2.3binsonar-runner.bat -Dproject.home=”$(SolutionDir).” -Dproject.settings=”$(SolutionDir)sonar-project.properties”
Or Using Invoke Process
4. Customize the BuildProcessTemplate. Add InvokeProcess to BuildProcessTemplate locate the
Run On Agent à Try Compile, Test, and Associate Changesets and Work Items activity.
5. Arguments : SourcesDirectory + “sonar-project.properties
6. FileName: “C:soanr-runner-2.3binsonar-runner.bat