Class ParamDefinitionAttribute
Defines a parameter for a build target, specifying its command-line name, description, and resolution sources.
[AttributeUsage(AttributeTargets.Property)]
public sealed class ParamDefinitionAttribute : ParamDefinitionAttributeBase
- Inheritance
-
objectAttributeParamDefinitionAttribute
- Inherited Members
Examples
public interface IMyTarget
{
[ParamDefinition("my-param", "A description of my parameter.")]
string MyParam => GetParam(() => MyParam);
}
Remarks
This attribute is used on properties within target definition interfaces to declare parameters. For sensitive values, use SecretDefinitionAttribute instead.
Constructors
ParamDefinitionAttribute(string, string, ParamSource, string[]?)
Initializes a new instance of the ParamDefinitionAttribute class.
public ParamDefinitionAttribute(string argName, string description, ParamSource sources = ParamSource.All, string[]? chainedParams = null)
Parameters
argNamestringThe name of the parameter on the command line (e.g., "my-param").
descriptionstringA description of the parameter for help text.
sourcesParamSourceThe sources from which the parameter can be resolved.
chainedParamsstring[]An array of other parameters that this parameter depends on.