Using Console Application of Designite

You can analyze your C# projects on a command line with Designite’s console application. With it, you can export the results of the analysis either in an excel sheet or an XML file. The generated output then can be consumed as desired either manually or by another user application. This post summarizes all the different options available for the console application.

If you invoke DesigniteConsole.exe on the command line without any parameters, it emits the usage instructions as shown in the above figure. Let us understand the usage instructions in more detail.

The first argument is either a Visual Studio solution file (.sln) or a batch file. A batch file contains the path of the projects that you would like to analyze (one path per line). For example, here is a sample batch file.

BatchFile

In either case, you need to provide the absolute path of the input file in double quotes.
The second argument to the console application is Option, which could be “-X”, “-E”, or “-C”. The option “-X” instructs the console application to generate an XML file as an outcome of the analysis. The option “-E” produces an MS Excel file and the option “-C” produces a set of CSV (comma-separated values) as an outcome of the analysis. Each of the above formats produces file(s) containing computed metrics (both at class and method level), detected design smells and implementation smells, as well as identified code clones.

The third argument to the application is the output file path in double quotes. With “-E” and “-X” options, specify a file name (with absolute path) with the extension “.xls” and “.xml” respectively. For the “-C” option, specify a folder path. Refer the below examples for each option.

  • DesigniteConsole.exe “C:\Workspace\NUnit-3.0.1-src\nunit.sln” -E “C:\temp\result.xls”
  • DesigniteConsole.exe “C:\Workspace\NUnit-3.0.1-src\nunit.sln” -X “C:\temp\result.xml”
  • DesigniteConsole.exe “C:\Workspace\NUnit-3.0.1-src\nunit.sln” -C “C:\temp”
  • DesigniteConsole.exe “C:\Designite\sample.batch” -X “C:\temp\result1.xml”
  • DesigniteConsole.exe “C:\Designite\sample.batch” -E “C:\temp\result1.xls”
  • DesigniteConsole.exe “C:\Designite\sample.batch” -C “C:\temp”

You may use the console application to enrich your existing tool-chain used specifically for source-code analysis targeted towards code quality measurement and improvement. For example, the console application is being used to integrate Designite with SonarQube.