C# Class WixSharp.ManagedAction

Defines WiX Managed CustomAction.

Managed CustomAction can be defined either in the Wix# script or in the external assembly or C# file. The only requirements for any C# method to be qualified for being Managed CustomAcyion is to have DTF Action signature public static ActionResult MyManagedAction(Session session), and be marked with [CustomAction] attribute.

If Managed CustomAction depends on any assembly, which will not be registered with GAC on the target system such assembly needs to be listed in the ManagedAction.RefAssemblies.

ManagedAction often needs to be executed with the elevated privileges. Thus after instantiation it will have Action.Impersonate set to false and Action.Execute set to Execute.deferred to allow elevating.
Inheritance: Action
ファイルを表示 Open project: Eun/WixSharp Class Usage Examples

Public Properties

Property Type Description
ActionAssembly string
DefaultUsesProperties string
MethodName string
RefAssemblies string[]
UsesProperties string

Public Methods

Method Description
ManagedAction ( ) : System

Initializes a new instance of the ManagedAction class.

ManagedAction ( Id id, string name ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( Id id, string name, Return returnType, When when, Step step, Condition condition ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( Id id, string name, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( Id id, string name, string actionAssembly ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( Id id, string name, string actionAssembly, Return returnType, When when, Step step, Condition condition ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( Id id, string name, string actionAssembly, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( string name ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( string name, Return returnType, When when, Step step, Condition condition ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( string name, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( string name, string actionAssembly ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( string name, string actionAssembly, Return returnType, When when, Step step, Condition condition ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

ManagedAction ( string name, string actionAssembly, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.

Private Methods

Method Description
ExpandAllUsedProperties ( ) : string
GetRefAssembliesHashCode ( IEnumerable defaultAssemblies ) : int

Method Details

ManagedAction() public method

Initializes a new instance of the ManagedAction class.
public ManagedAction ( ) : System
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( Id id, string name ) : System
id Id The explicit to be associated with instance.
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( Id id, string name, Return returnType, When when, Step step, Condition condition ) : System
id Id The explicit to be associated with instance.
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( Id id, string name, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System
id Id The explicit to be associated with instance.
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
sequence WixSharp.Sequence The MSI sequence the action belongs to.
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( Id id, string name, string actionAssembly ) : System
id Id The explicit to be associated with instance.
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
actionAssembly string Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly /// is in the Wix# script.
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( Id id, string name, string actionAssembly, Return returnType, When when, Step step, Condition condition ) : System
id Id The explicit to be associated with instance.
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
actionAssembly string Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly /// is in the Wix# script.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( Id id, string name, string actionAssembly, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System
id Id The explicit to be associated with instance.
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
actionAssembly string Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly /// is in the Wix# script.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
sequence WixSharp.Sequence The MSI sequence the action belongs to.
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( string name ) : System
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( string name, Return returnType, When when, Step step, Condition condition ) : System
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( string name, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
sequence WixSharp.Sequence The MSI sequence the action belongs to.
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( string name, string actionAssembly ) : System
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
actionAssembly string Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly /// is in the Wix# script.
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( string name, string actionAssembly, Return returnType, When when, Step step, Condition condition ) : System
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
actionAssembly string Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly /// is in the Wix# script.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
return System

ManagedAction() public method

Initializes a new instance of the ManagedAction class with properties/fields initialized with specified parameters.
public ManagedAction ( string name, string actionAssembly, Return returnType, When when, Step step, Condition condition, WixSharp.Sequence sequence ) : System
name string Name of the CustomAction. The name should match the method implementing the custom action functionality.
actionAssembly string Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly /// is in the Wix# script.
returnType Return The return type of the action.
when When the action should be executed with respect to the parameter.
step Step the action should be executed before/after during the installation.
condition Condition The launch condition for the .
sequence WixSharp.Sequence The MSI sequence the action belongs to.
return System

Property Details

ActionAssembly public_oe property

Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly is in the Wix# script.

Default value is %this%.

public string ActionAssembly
return string

DefaultUsesProperties public_oe static_oe property

The default properties mapped for use with the deferred custom actions. See ManagedAction.UsesProperties for the details.

The default value is "INSTALLDIR,UILevel"

public static string DefaultUsesProperties
return string

MethodName public_oe property

Name of the method implementing the Managed CustomAction action functionality.
public string MethodName
return string

RefAssemblies public_oe property

Collection of path strings for dependency assemblies to be included in MSI. RefAssemblies should be used if the Managed CustomAction depends on any assembly, which will not be registered with GAC on the target system.
public string[] RefAssemblies
return string[]

UsesProperties public_oe property

Comma separated list of properties which the custom action is intended to use. Set this property if you are implementing the deferred action.

Deferred custom actions cannot access any session property as the session is terminated at the time of the action execution (limitation of MSI). The standard way of overcoming this limitation is to create a new custom action for setting the property, set the property name to the name of the deferred action, set the property value to the specially formatted map, schedule the execution of the custom action and access the mapped properties only via T:Microsoft.Deployment.WindowsInstaller.Session.CustomActionData.

All this can be done in a single hit with Wix# as it fully automates creation of the all mapping infrastructure.

Note that you don't even have to specify UsesProperties = "INSTALLDIR" as by default Wix# always maps INSTALLDIR and UILevel for all deferred managed actions. The default mapping is controlled by ManagedAction.DefaultUsesProperties.

It is also possible to map the 'deferred' properties in the typical WiX way:

UsesProperties = "CONFIG_FILE=[INSTALLDIR]MyApp.exe.config, APP_FILE=[INSTALLDIR]MyApp.exe"
public string UsesProperties
return string