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.
Before you can create a build specification, you need to install the Server or User package. See Installing Klocwork.
Capture your build settings
You can also check out our cheat sheet as a quick reference C-sharp integration build analysis - Cheat sheet.
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:
kwinject --overwrite msbuild Project.sln /t:Rebuild /p:UseSharedCompilation=false /p:ProduceReferenceAssembly=falseNote that the msbuild options /p:UseSharedCompilation=false and /p:ProduceReferenceAssembly=false are both required, otherwise the analysis would not be as accurate.
kwinject dotnet msbuild Project.sln /p:UseSharedCompilation=false /p:ProduceReferenceAssembly=false
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 kwinject 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.
- If you're analyzing your integration project, go to Running the C# integration build analysis.
- If you're analyzing a desktop project, go to Getting started with Klocwork Desktop Plug-in for Visual Studio.