Partager via


Rule Class

Definition

Used to represent the schema information for a Tool, a Custom Build Rule, a PropertyPage, etc.

public ref class Rule sealed : Microsoft::Build::Framework::XamlTypes::RuleSchema, Microsoft::Build::Framework::XamlTypes::IProjectSchemaNode, System::ComponentModel::ISupportInitialize
[System.Windows.Markup.ContentProperty("Properties")]
public sealed class Rule : Microsoft.Build.Framework.XamlTypes.RuleSchema, Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode, System.ComponentModel.ISupportInitialize
[<System.Windows.Markup.ContentProperty("Properties")>]
type Rule = class
    inherit RuleSchema
    interface ISupportInitialize
    interface IProjectSchemaNode
Public NotInheritable Class Rule
Inherits RuleSchema
Implements IProjectSchemaNode, ISupportInitialize
Inheritance
Attributes
Implements

Remarks

Normally represented on disk as XAML, only one instance of this class is maintained per XAML file per project engine (solution).

Those who manually instantiate this class should remember to call BeginInit() before setting the first property and EndInit() after setting the last property of the object.

Constructors

Rule()

Default constructor. Needed for deserialization from a persisted format.

Properties

AdditionalInputs

When this Rule represents a Build Customization, this field defines the semicolon separated list of additional inputs that are going to be evaluated for the Build Customization target.

Categories

The list of Categorys that properties in this Rule belong to.

CommandLine

When this Rule represents a Build Customization, this field represents the command line template that is going to be used by a Build Customization task to invoke the tool.

DataSource

The DataSource for all the properties in this Rule. This is overriden by any data source defined locally for a property.

Description

Description of this Rule for use by a prospective UI client.

DisplayName

The name that could be used by a prospective UI client to display this BaseProperty.

EvaluatedCategories

This property returns the union of XAML specified Categorys and auto-generated Categorys. The latter are created from the missing categories that are being referred to by the properties in this Rule. The auto-generated Categorys only have their name set.

ExecutionDescription

When this Rule represents a Build Customization, this field represents the message to be displayed before executing a Build Customization during the build.

FileExtension

When this Rule represents a Build Customization, this field represents the file extension to associate.

HelpString

Help information for this Rule.

Metadata

Gets or sets arbitrary metadata that may be set on a rule.

Name

The name of this Rule.

Order

This is a suggestion to a prospective UI client on the relative location of this Rule compared to all other Rules in the system.

Outputs

When this Rule represents a Build Customization, this field defines the semicolon separated list of outputs that are going to be evaluated for the Build Customization target.

OverrideMode

Gets or sets the method to use when multiple rules with the same name appear in the project to reconcile the rules into one instance.

PageTemplate

The UI renderer template used to display this Rule.

Properties

This list of properties in this Rule. Atleast one property should be specified.

PropertyPagesHidden

Gets or sets a value indicating if property pages for this rule should be hidden or not.

Separator

The token used to separate a property switch from its value.

ShowOnlyRuleProperties

Indicates whether to hide the command line category or not. Default value is true.

SupportsFileBatching

This is used to specify whether multiple files need to be batched on one command line invocation.

SwitchPrefix

The prefix to use for all property switches in this Rule for the case when this property Rule represent a tool.

ToolName

The name of the tool executable when this rule represents a tool.

Methods

BeginInit()

See ISupportInitialize.

EndInit()

See ISupportInitialize.

GetPropertiesByCategory()

Returns all properties partitioned into categories. The return value is never null. The returned list may contain auto-generated categories. Note that if a BaseProperty (or its derived classes) refer to a property that is not specified, then an new Category is generated for the same. If not category is specified for the property, then the property is placed in the "General" category. The list of categories is exactly as specified in the Xaml file. The auto-generated categories come (in no strict order) after the specified categories.

GetPropertiesInCategory(String)

Returns the list of properties in a Category. Returns null if this Rule doesn't contain this category.

GetProperty(String)

Returns a property with a given name.

GetSchemaObjects(Type)

see IProjectSchemaNode

GetSchemaObjectTypes()

see IProjectSchemaNode

Applies to