craft_parts.plugins.dotnet_v2_plugin module¶
The new .NET plugin.
- class craft_parts.plugins.dotnet_v2_plugin.DotnetConfiguration(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
-
The .NET build configuration.
- DEBUG = 'Debug'¶
Build with debug symbols and no optimizations.
- RELEASE = 'Release'¶
Build with optimizations and no debug symbols. This is the default configuration.
- class craft_parts.plugins.dotnet_v2_plugin.DotnetV2Plugin(*, properties, part_info)¶
Bases:
PluginA plugin for .NET projects.
The .NET plugin uses the common plugin keys as well as those for “sources”. Additionally, the following plugin-specific keys can be used:
Global Flags:
dotnet-configuration(string) The .NET build configuration to use. (Default: “Release”).dotnet-project(string) The .NET proj or solution file to build. (Default: omitted).dotnet-properties(dictionary of strings to strings) The list of MSBuild properties to be used by the restore, build, and publish commands. (Default: empty).dotnet-self-contained(bool) Build and publish the project as a self-contained application. (Default: False).dotnet-verbosity(string) The verbosity level of the build output. Possible values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. (Default: “normal”).dotnet-version(string) The version of the .NET SDK to download and use. This parameter is optional, so if no value is specified, the plugin will assume a .NET SDK is being provided and will not attempt to download one.
Restore-specific Flags:
dotnet-restore-sources(string) The URI of the NuGet package sources to use during the restore operation. Multiple values can be specified. This setting overrides all of the sources specified in the nuget.config files. (Default: omitted).dotnet-restore-properties(dictionary of strings to strings) The list of MSBuild properties to be used by the restore command. (Default: empty).dotnet-restore-configfile(string) The NuGet configuration file (nuget.config) to use. (Default: omitted).
Build-specific Flags:
dotnet-build-framework(string) The target framework to build for. (Default: omitted).dotnet-build-properties(dictionary of strings to strings) The list of MSBuild properties to be used by the build command. (Default: empty).
Publish-specific Flags:
dotnet-publish-properties(dictionary of strings to strings) The list of MSBuild properties to be used by the publish command. (Default: empty).
- Parameters:
properties (
PluginProperties)part_info (
PartInfo)
- get_build_commands()¶
Return a list of commands to run during the build step.
- get_build_environment()¶
Return a dictionary with the environment to use in the build step.
- get_build_packages()¶
Return a set of required packages to install in the build environment.
- get_build_snaps()¶
Return a set of required snaps to install in the build environment.
- properties_class¶
alias of
DotnetV2PluginProperties
- validator_class¶
alias of
DotnetV2PluginEnvironmentValidator
- class craft_parts.plugins.dotnet_v2_plugin.DotnetV2PluginEnvironmentValidator(*, part_name, env, properties)¶
Bases:
PluginEnvironmentValidatorCheck the execution environment for the .NET plugin.
- Parameters:
part_name (
str) – The part whose build environment is being validated.env (
str) – A string containing the build step environment setup.properties (
PluginProperties)
- class craft_parts.plugins.dotnet_v2_plugin.DotnetV2PluginProperties(**data)¶
Bases:
PluginPropertiesThe part properties used by the .NET plugin.
- Parameters:
data (
Any)
-
dotnet_build_framework:
str|None¶ The specific .NET framework to compile for.
The framework must be defined in the .NET project file.
-
dotnet_build_properties:
dict[str,str]¶ The MSBuild properties to append to the build command, in the format
-p:<Key>=<Value>.
-
dotnet_configuration:
DotnetConfiguration¶ The .NET build configuration to use.
-
dotnet_project:
str|None¶ The path to the solution or project file to build, relative to the root of the snap source.
If a path isn’t specified, MSBuild will search the root of the source for a file with the
.*projor.slnextension.
-
dotnet_properties:
dict[str,str]¶ The MSBuild properties to append to the restore, build, and publish commands.
-
dotnet_publish_properties:
dict[str,str]¶ The MSBuild properties to append to the publish command, in the format
-p:<Key>=<Value>.
-
dotnet_restore_configfile:
str|None¶ The path to the part’s NuGet configuration file.
If set, only the settings from this file will be used.
If unset, the hierarchy of configuration files from the current directory will be used. For more information, see Common NuGet Configurations.
-
dotnet_restore_sources:
list[str]¶ The URIs of the NuGet package sources for use during a restore.
If set, the URIs override all of the sources declared in the
nuget.configfiles.
-
dotnet_self_contained:
bool¶ Whether to create a self-contained .NET part.
The Runtime Identifier will be automatically set based on the value of the
$CRAFT_BUILD_FORenvironment variable:$CRAFT_BUILD_FORvalueRuntime Identifier
amd64linux-x64arm64linux-arm64
-
dotnet_verbosity:
DotnetVerbosity¶ The verbosity of the MSBuild log.
-
dotnet_version:
str|None¶ The .NET version to build the part with.
If set, the plugin will download the necessary .NET SDK content snap and use it to build the app.
See Dependencies for a more detailed explanation of this key.
- model_config: ClassVar[ConfigDict] = {'alias_generator': <function PluginProperties.<lambda>>, 'extra': 'forbid', 'frozen': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class craft_parts.plugins.dotnet_v2_plugin.DotnetVerbosity(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
-
The .NET build verbosity level.
- DETAILED = 'detailed'¶
Show detailed build output.
- DETAILED_SHORT = 'd'¶
Alias for
detailed.
- DIAGNOSTIC = 'diagnostic'¶
Show diagnostic build output, the most verbose level.
- DIAGNOSTIC_SHORT = 'diag'¶
Alias for
diagnostic.
- MINIMAL = 'minimal'¶
Show minimal build output.
- MINIMAL_SHORT = 'm'¶
Alias for
minimal.
- NORMAL = 'normal'¶
Show normal build output. This is the default level.
- NORMAL_SHORT = 'n'¶
Alias for
normal.
- QUIET = 'quiet'¶
Show only errors.
- QUIET_SHORT = 'q'¶
Alias for
quiet.