6.1.2.1. AxivionC#Frontend¶
Use Axivion C# compiler for analysis compilation
Compiles a given input and (optionally) creates a C# package (.cspkg), which can be used in an independent Axivion analysis, without having to rebuild.
The input parameters can be configured in two ways:
-
One or more loose C# files without a project:
- The primary input should point to a .cs file or a folder containing one or more .cs files.
- The option build_target_framework is mandatory in this case and must specify the target framework name that should be used. This should be in sync with the framework_path option.
- The option project_is_library indicates whether the input should be compiled as library, i.e., if any of the input files contains a usable Main method, this property should be set to false, otherwise to true.
- The option framework_path can used to set the framework directory to be used. Defaults to .NET 8.0.
- The option references can be used to pass additional references that should be included in the compilation.
-
A MSBuild-based C# project, solution or solution filter:
- The primary input should point to a C# project (.csproj), a solution (.sln) or a solution filter (.slnf).
- If the solution or project supports multiple target frameworks, the option build_target_framework is used to specify the target framework that should be used in the analysis.
- The parameter msbuild_path can be used to specify a specific version of MSBuild to be used. It should point directly to MSBuild.exe (or MSBuild.dll).
- The parameters properties, build_configuration, build_platform, build_targets, build_in_parallel, as well as no_restore can be used to exercise finer control over the analysis build performed by AxivionC#Frontend.
Options¶
The following places define options that affect this rule: BuildSystemIntegration, Project-GlobalOptions
abort_on_error¶
abort_on_error : bool = True
base_path¶
base_path : bauhaus.analysis.config.PlainPath | None = None
AxivionC#Frontend
(i.e., RFG or C# package or analysis results) are stored relative to this path.
Defaults to the location of the primary input (see input).
binarylog¶
binarylog : bauhaus.analysis.config.PlainPath | None = None
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
If set, a MSBuild binlog will be produced for each project that is processed by this step.
This is useful for diagnosing issues with how AxivionC#Frontend processes projects.
The generated .binlog file(s) can be viewed using the (third-party)
MSBuild Structured Log Viewer, which can be obtained
from https://msbuildlog.com/.
build_configuration¶
build_configuration : str | None = None
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Build configuration to use for compilation.
build_in_parallel¶
build_in_parallel : bool = False
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Whether to run msbuild in parallel using the number of processor cores on a machine.
build_platform¶
build_platform : str | None = None
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Build platform to use for compilation.
build_target_framework¶
build_target_framework : str | None = None
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Build target framework to use for compilation. If left unspecified, attempt to detect it automatically.
build_targets¶
build_targets : list[str] = ['Clean', 'Build']
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Build targets to invoke. Multiple values can be specified separated by comma or
semi-colon. Defaults to Clean, Build.
bytecode_analysis¶
bytecode_analysis : bool = False
create_multiple_edges¶
create_multiple_edges : bool = False
Warning: This cannot be set in a CI context (i.e. when using
axivion_ci).
cwd¶
cwd : bauhaus.analysis.config.ProjectRelativePath | None = None
csharp2rfg. Defaults to
/Project/directory if left unspecified.
framework_path¶
framework_path : bauhaus.analysis.config.PlainPath | None = None
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Should point to the directory containing all framework assemblies in the .NET
(Core) SDK or .NET Framework installation.
Defaults to the version of .NET used to run csharp2rfg
input¶
input : bauhaus.analysis.config.ProjectRelativePath = 'None (value must be set)'
- MSBuild solution file (.sln),
- MSBuild solution filter file (.slnf),
- MSBuild C# project file (.csproj),
- A single C# source file (.cs)
- or a folder containing one or more C# source files.
msbuild_path¶
msbuild_path : bauhaus.analysis.config.PlainPath | None = None
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Sets the path to the version of MSBuild to be used to load the solution/project.
This should point directly to MSBuild.exe (or MSBuild.dll
for .NET (Core) SDKs) that is used to build the solution or project.
no_restore¶
no_restore : bool = False
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
If set, no NuGet package restore will be performed.
only_used_types¶
only_used_types : bool = False
output¶
output : bauhaus.analysis.config.ProjectRelativePath | None = None
project_is_library¶
project_is_library : bool = False
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Use this flag to indicate, whether the result is a library or executable binary, i.e., has a Main method/entry-point.
properties¶
properties : dict[str, str] = {}
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Additional MSBuild properties to use for compilation. They can be used to fine-tune the build process.
Properties that are useful when working with csharp2rfg:
RunAnalyzers: Set this tofalseto prevent execution of third-party analyzers during the analysis build.RunAnalyzersDuringBuild: Set this tofalseto prevent execution of third-party analyzers during the analysis build.
references¶
references : list[str] = []
AxivionC#Frontend is
configured with a project or solution (filter). See the rule description for an overview.
Binary references (.dll) to use for compilation.