C-sharp integration build analysis - Cheat sheet

In this topic:
An integration build analysis
  • gives you a snapshot of the current health of your software project. After you run an analysis, detected issues and reports are available in Validate.
  • is the first step in establishing the connected desktop in your organization.
Prerequisities:
  • Installing Klocwork
  • The first time you run the kwinject command on a project, verify that you have a clean build of that project. You can do this by running the clean command, for example, msbuild Project.sln /t:Clean.

Your first analysis
  1. Create a project:
    kwadmin --url http://server2:8080/ create-project my_project
  2. Capture your build settings:
    kwinject <my_build_command>

    Note that the msbuild options /p:UseSharedCompilation=false and /p:ProduceReferenceAssembly=false are both required, otherwise the analysis will not be as accurate.

    Once you've got a build specification, confirm the existence of the cscompile and csconfig lines. For more information, see Format of the build specification file.

  3. Run the analysis:
    kwbuildproject --url http://server2:8080/my_project --tables-directory /my_tables kwinject.out
  4. Load the database:
    kwadmin --url http://server2:8080/ load my_project /my_tables

Details:Running the C-sharp integration build analysis

Your next analysis
Subsequent analyses are incremental by default. Use the same commands as you used for your first analysis.

Important: To take advantage of incremental analysis, don't delete your tables directory.

Re-run a full analysis

Whenever you do a clean build (full rebuild of your source files), you should run a full build analysis.

  1. Create a new build specification:
    kwinject --overwrite <my_build_command>
  2. Run the analysis:
    kwbuildproject --url http://server2:8080/my_project --force --tables-directory /my_tables kwinject.out
  3. Load the database:
    kwadmin --url http://server2:8080/ load my_project /my_tables

Details:Running the C-sharp integration build analysis