Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

Creating a C-sharp build specification

Creating a C-sharp build specification

Klocwork integrates with your build, capturing all of the information it needs to provide a centralized view of the entire code stream.

Klocwork stores this information in a structured build log -- a text file we call a build specification. The build specification is the basis of the Klocwork analysis.

It's important that the build specification is an accurate and up-to-date representation of your build. If the build specification is inaccurate, the Klocwork analysis will be inaccurate too.

A build specification is required at both the integration and local build levels.

  • For the integration build, creating a build specification is the first essential task following installation.
  • For some desktop environments, build integration happens automatically; for others, you need to create a build specification manually. If you're not sure whether you need to create a build specification manually, go to Fixing issues before check-in with Klocwork Desktop Analysis and choose your coding environment.

This article covers pure C# projects. If your project also contains C/C++ source, first go to Analyzing mixed C/C++ and C# projects.

Prerequisites

Before you can create a build specification, you need to install the Server or User package. See Installing Klocwork.

Capture your build settings

The example uses the open-source project NAnt, version 0.85. If you're using your own source code, substitute your information for the NAnt-specific information:

  1. Change the working directory to the top-level source directory that contains the project or solution file, for example:
     cd C:\nant-0.85\ 
    
    Note: A typical open-source project may require some initial setup.
  2. If you don't know the valid build configurations for your project, list them with the C# project parser, kwcsprojparser:
    kwcsprojparser <input_file> --list-configs
    
    For example:
    kwcsprojparser nant.vsnet.csproj --list-configs
    
  3. You'll see a list of valid build configurations, for example:
    DebugMainNAntBuildFile|Any CPU
    Debug|Any CPU
  4. Run kwcsprojparser against your project file or solution file to generate the build specification:
    kwcsprojparser <input_file> --config <config_name> [--output <output_file>]
    
    If you don't use the --output option, kwcsprojparser automatically names the build specification file with the name of your input file, adds the extension .out, and saves it to the current working directory. If you don't specify a configuration, the tool will use the first one found.
    Example:
    kwcsprojparser nant.vsnet.csproj --config "Debug|Any CPU"
    
    Once your build is complete, the build specification is saved to the specified location.

Review your build specification for accuracy

Once you've got a build specification:

  • Confirm the existence of cscompile, cslink and csconfig lines.
  • Carefully review the build specification to ensure that your compiler options have been processed properly. For more information on making sure kwcsprojparser has accurately captured your build settings, see Format of the build specification file for C# projects.

If your build specification is valid, you're ready to move to the next step: Running the C# integration build analysis.

What's next?