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, PluginModel

The part properties used by the Dotnet plugin.

Parameters:

data (Any) –

dotnet_build_configuration: str
dotnet_self_contained_runtime_identifier: Optional[str]
source: str
classmethod unmarshal(data)[source]

Populate make properties from the part specification.

Parameters:

data (Dict[str, Any]) – A dictionary containing part properties.

Return type:

DotnetPluginProperties

Returns:

The populated plugin properties data object.

Raises:

pydantic.ValidationError – If validation fails.