craft_parts.plugins.dotnet_plugin module

The Dotnet plugin.

class craft_parts.plugins.dotnet_plugin.DotPluginEnvironmentValidator(*, part_name, env, properties)[source]

Bases: PluginEnvironmentValidator

Check the execution environment for the Dotnet 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)

validate_environment(*, part_dependencies=None)[source]

Ensure the environment contains dependencies needed by the plugin.

Parameters:

part_dependencies (Optional[list[str]]) – A list of the parts this part depends on.

Return type:

None

class craft_parts.plugins.dotnet_plugin.DotnetPlugin(*, properties, part_info)[source]

Bases: Plugin

A plugin for dotnet projects.

The dotnet plugin requires dotnet installed on your system. This can be achieved by adding the appropriate dotnet snap package to build-snaps, or to have it installed or built in a different part. In this case, the name of the part supplying the dotnet compiler must be “dotnet”.

The dotnet plugin uses the common plugin keywords as well as those for “sources”. Additionally, the following plugin-specific keywords can be used:

  • dotnet-build-configuration (string) The dotnet build configuration to use. The default is “Release”.

  • dotnet-self-contained-runtime-identifier (string) Create a self contained dotnet application using the specified RuntimeIdentifier.

Parameters:
get_build_commands()[source]

Return a list of commands to run during the build step.

Return type:

list[str]

get_build_environment()[source]

Return a dictionary with the environment to use in the build step.

Return type:

dict[str, str]

get_build_packages()[source]

Return a set of required packages to install in the build environment.

Return type:

set[str]

get_build_snaps()[source]

Return a set of required snaps to install in the build environment.

Return type:

set[str]

properties_class

alias of DotnetPluginProperties

validator_class

alias of DotPluginEnvironmentValidator

class craft_parts.plugins.dotnet_plugin.DotnetPluginProperties(**data)[source]

Bases: PluginProperties

The part properties used by the Dotnet plugin.

Parameters:

data (Any)

dotnet_build_configuration: str
dotnet_self_contained_runtime_identifier: str | None
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].

plugin: Literal['dotnet']
source: str