Condividi tramite


VCProject.AddRuleDefinition Method

Adds a rule to the project so that it is available as an IVCRulePropertyStorage.

Namespace:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Syntax

'Declaration
Function AddRuleDefinition ( _
    bstrRuleFilePath As String, _
    bstrContext As String, _
    bPersistInProject As Boolean _
) As Boolean
bool AddRuleDefinition(
    string bstrRuleFilePath,
    string bstrContext,
    bool bPersistInProject
)
bool AddRuleDefinition(
    [InAttribute] String^ bstrRuleFilePath, 
    [InAttribute] String^ bstrContext, 
    [InAttribute] bool bPersistInProject
)
abstract AddRuleDefinition : 
        bstrRuleFilePath:string * 
        bstrContext:string * 
        bPersistInProject:bool -> bool
function AddRuleDefinition(
    bstrRuleFilePath : String, 
    bstrContext : String, 
    bPersistInProject : boolean
) : boolean

Parameters

  • bstrRuleFilePath
    Type: System.String

    The path to a XAML file that contains a rule. May be a full path or relative to the project.

  • bstrContext
    Type: System.String

    A semicolon-delimited list of contexts in which this rule applies.

  • bPersistInProject
    Type: System.Boolean

    Specify true to add the rule to the project permanently, or false to add the rule only until it is unloaded.

Return Value

Type: System.Boolean
true if the rule was actually added to the project; false if the rule was already defined in the project.

Remarks

This method adds a PropertyPageSchema item to the project file. No condition is attached to the added item.

To read the rule just added, browse through Rules for any configuration.

.NET Framework Security

See Also

Reference

VCProject Interface

Microsoft.VisualStudio.VCProjectEngine Namespace