In order to use the plugin, you must install the following prerequisite application on the machine and define the associated properties in the maven settings.xml file, either in the $M2_HOME/conf/ directory (recommended as it is mostly machine-specific) or in $HOME/.m2 directory.
To use the different goals, you must first install the .Net framework if it is not bundled in your system.
The following application are use by the different goals:
|Application||Property||Usage||Supported Version||Download site|
|MSBuild||dotnet.3.5.sdk.dir||.Net sdk install dir||2.0, 3.5||http://msdn.microsoft.com/en-us/netframework/aa569263.aspx|
|Gallio||gallio.directory||.Net test runner||3.1 Update 2 +||http://www.gallio.org|
|PartCover||partcover.directory||.Net code coverage||2.2, 2.3 and 4.0||http://github.com/sawilde/partcover.net4|
|NCover||useNCover (boolean)||.Net code coverage||3.0||http://www.ncover.com|
|Source Monitor||sourcemoniter.directory||C# code metrics||2.5 +||http://www.geardownload.com/development/sourcemonitor-download.html|
|Fx Cop||fxcop.directory||.Net code quality reports||1.36 +||http://www.infoq.com/news/2010/06/FXCop-10|
|Style Cop *||stylecop.directory||C# code style report||4.3+||http://code.msdn.microsoft.com/sourceanalysis|
|Mono Gendarme **||gendarme.directory||.Net code quality reports||2.10+||http://www.mono-project.com/Gendarme|
* Style Cop 4.4 is bundle with the maven dotnet plugin since version 0.3 . Thus installation of Style Cop is not mandatory.
** Gendarme 2.10 is bundle with the maven dotnet plugin. Thus installation of Gendarme is not mandatory.
There is a bug in the coverage reports generated by PartCover 2.3 and 4.0 (prior to version 4.0.11013), in which the source files that have no line covered are excluded, and thus, the coverage percentage only corresponds to the coverage of ... the covered files :-(
NCover is a commercial alternative to PartCover. After having installed NCover3, you can activate it for sonar by setting property useNCover to true. NCover3 has the advantages of not suffering from the bug described before and working perfectly on a 64bit OS.
Indeed, if you are using a 64bit OS with PartCover, you need to play a little bit with tool CorFlags.exe as it is described here : http://stackoverflow.com/questions/256287/how-do-i-run-partcover-in-x64-windows.
PartCover.exe and Gallio.Echo.exe need to be modified using CorFlags.
To use the plugin, you just need to add a pom.xml in the root folder of the .Net solution, in the directory where the '.sln' file is located as described in this example.
You will also need to provide a path to the installation of .Net, and other tools if required for the different generated reports as described here.