The SARIF SDK contains .NET code and supporting files for working with the Static Analysis Results Interchange Format (SARIF). For more information about SARIF, see the SARIF Home Page. You can read the SARIF specification, or file issues in the SARIF GitHub repo.
The types in the SARIF SDK are in the
The SARIF SDK provides a set of classes which represent the elements of the SARIF format. We refer to this as the "SARIF object model". The root type that represents a SARIF log file is
SarifLog. Other types in the SARIF object model are
Note: The SARIF SDK's build process automatically generates the SARIF object model classes from the SARIF JSON schema, which you can find at
src/Sarif/Schemata/Sarif.schema.json. Although these files do exist in the repo (under
src/Sarif/Autogenerated), you should never edit them by hand.
In addition to the object model, the SARIF SDK provides a set of helper classes to facilitate using Newtonsoft.Json to read and write SARIF log files.
Building the SDK
If you want to build the SDK from source, rather than consuming the NuGet package, proceed as follows:
Install .NET Core SDK 2.0 from https://www.microsoft.com/net/download/core
Ensure that Visual Studio 2017 is installed on your machine.
You can build in VS 2017, but at present the build requires certain assemblies that are supplied only in VS 2015, so it must be present.
Ensure that your Visual Studio installation includes the components that support
- C# development
- C++ development
- Visual Studio extension (VSIX) development
Open a Visual Studio 2017 Developer Command Prompt Window.
From the root directory of your local repo, run the command
BuildAndTest.cmd. This restores all necessary NuGet packages, builds the SDK, and runs all the tests.
All build output appears in the
bld\subdirectory of the repo root directory.
NOTE: You must run
BuildAndTest.cmdonce before attempting to build in Visual Studio, to ensure that all required NuGet packages are available.
After you have run
BuildAndTest.cmdonce, you can open any of the solution files in the
src\directory in Visual Studio 2017, and build them by running Rebuild Solution.
Installing VISUAL STUDIO SARIF VIEWER EXTENSION
- Install the SARIF Visual Studio Extension and
- Add Registry settings to open the .SARIF in Visual Studio.
Accomplishing common tasks
To learn how to accomplish common tasks with the SARIF SDK, such as reading and writing files from disk, see the How To page.