Specifies predefined values for Action.Step, which controls order of Custom Action to be executed.

Before or After switch for Custom Action is controlled by When.

Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElevatedManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly 
 /// is in the Wix# script.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 public ElevatedManagedAction(string name, string actionAssembly, Return returnType, When when, Step step, Condition condition)
     : base(name, actionAssembly, returnType, when, step, condition)
 {
     Impersonate = false;
     Execute = Execute.deferred;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ManagedAction"/> instance.</param>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly 
 /// is in the Wix# script.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public ManagedAction(Id id, string name, string actionAssembly, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, returnType, when, step, condition, sequence)
 {
     Name = "Action" + (++count) + "_" + name;
     MethodName = name;
     ActionAssembly = actionAssembly;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElevatedManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 public ElevatedManagedAction(string name, Return returnType, When when, Step step, Condition condition)
     : base(name, returnType, when, step, condition)
 {
     Impersonate = false;
     Execute = Execute.deferred;
     UsesProperties = "INSTALLDIR";
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ManagedAction"/> instance.</param>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 public ManagedAction(Id id, string name, Return returnType, When when, Step step, Condition condition)
     : base(id, returnType, when, step, condition)
 {
     Name = "Action" + (++count) + "_" + name;
     MethodName = name;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public ManagedAction(string name, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(returnType, when, step, condition, sequence)
 {
     Name = "Action" + (++count) + "_" + name;
     MethodName = name;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="BinaryFileAction"/> instance.</param>
 /// <param name="key">The key (file name) of the installed file to be executed.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="BinaryFileAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public BinaryFileAction(Id id, string key, string args, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, returnType, when, step, condition, sequence)
 {
     Key = key;
     Args = args;
     Name = "Action" + (++count) + "_" + key;
 }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="action">The full name of static CustomAction method.</param>
        /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ManagedAction"/> instance.</param>
        /// <param name="returnType">The return type of the action.</param>
        /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
        /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
        /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
        public ManagedAction(Id id, CustomActionMethod action, Return returnType, When when, Step step, Condition condition)
            : base(id, returnType, when, step, condition)
        {
            string name = action.Method.Name;

            Name       = "Action" + (++count) + "_" + name;
            MethodName = name;
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="action">The full name of static CustomAction method.</param>
        /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ManagedAction"/> instance.</param>
        /// <param name="returnType">The return type of the action.</param>
        /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
        /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
        /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
        /// <param name="rollback">The full name of static CustomAction rollback method.</param>
        public ManagedAction(Id id, CustomActionMethod action, Return returnType, When when, Step step, Condition condition, CustomActionMethod rollback)
            : base(id, returnType, when, step, condition)
        {
            string name = action.Method.Name;

            Name       = name;
            MethodName = name;
            Rollback   = rollback.Method.Name;
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ManagedAction"/> instance.</param>
        /// <param name="action">The full name of static CustomAction method.</param>
        /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly
        /// is in the Wix# script.</param>
        /// <param name="returnType">The return type of the action.</param>
        /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
        /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
        /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
        public ManagedAction(Id id, CustomActionMethod action, string actionAssembly, Return returnType, When when, Step step, Condition condition)
            : base(id, returnType, when, step, condition)
        {
            string name = action.Method.Name;

            Name           = name;
            MethodName     = name;
            ActionAssembly = actionAssembly;
        }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PathFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="PathFileAction"/> instance.</param>
 /// <param name="appPath">Path to the file to be executed on the target system.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="workingDir">Working directory for the file execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="PathFileAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public PathFileAction(Id id, string appPath, string args, string workingDir, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, returnType, when, step, condition, sequence)
 {
     AppPath = appPath;
     Args = args;
     WorkingDir = workingDir;
     Name = "Action" + (++count) + "_" + IO.Path.GetFileName(appPath);
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PathFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="PathFileAction"/> instance.</param>
 /// <param name="appPath">Path to the file to be executed on the target system.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="workingDir">Working directory for the file execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="PathFileAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public PathFileAction(Id id, string appPath, string args, string workingDir, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, returnType, when, step, condition, sequence)
 {
     AppPath    = appPath;
     Args       = args;
     WorkingDir = workingDir;
     Name       = "Action" + (++count) + "_" + IO.Path.GetFileName(appPath);
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="BinaryFileAction"/> instance.</param>
 /// <param name="key">The key (file name) of the installed file to be executed.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="BinaryFileAction"/>.</param>
 public BinaryFileAction(Id id, string key, string args, Return returnType, When when, Step step, Condition condition)
     : base(id, returnType, when, step, condition)
 {
     Key  = key;
     Args = args;
     Name = key;
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="key">The key (file name) of the installed file to be executed.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="BinaryFileAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public BinaryFileAction(string key, string args, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(returnType, when, step, condition, sequence)
 {
     Key  = key;
     Args = args;
     Name = key;
 }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ManagedAction"/> instance.</param>
        /// <param name="action">The full name of static CustomAction method.</param>
        /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly
        /// is in the Wix# script.</param>
        /// <param name="returnType">The return type of the action.</param>
        /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
        /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
        /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
        /// <param name="sequence">The MSI sequence the action belongs to.</param>
        public ManagedAction(Id id, CustomActionMethod action, string actionAssembly, Return returnType, When when, Step step, Condition condition, Sequence sequence)
            : base(id, returnType, when, step, condition, sequence)
        {
            string name = action.Method.Name;

            Name           = "Action" + (++count) + "_" + name;
            MethodName     = name;
            ActionAssembly = actionAssembly;
        }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElevatedManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ElevatedManagedAction"/> instance.</param>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly 
 /// is in the Wix# script.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public ElevatedManagedAction(Id id, string name, string actionAssembly, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, name, actionAssembly, returnType, when, step, condition, sequence)
 {
     Impersonate = false;
     Execute = Execute.deferred;
     UsesProperties = "INSTALLDIR";
 }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="action">The full name of static CustomAction method.</param>
        /// <param name="returnType">The return type of the action.</param>
        /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
        /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
        /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
        /// <param name="sequence">The MSI sequence the action belongs to.</param>
        public ManagedAction(CustomActionMethod action, Return returnType, When when, Step step, Condition condition, Sequence sequence)
            : base(returnType, when, step, condition, sequence)
        {
            string name = action.Method.Name;

            Name       = name;
            MethodName = name;
        }
Пример #17
0
 /// <summary>
 /// Executes a new instance of the <see cref="QtCmdLineAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="QtCmdLineAction"/> instance.</param>
 /// <param name="appPath">Path to the application to be executed. This can be a file name only if the location of the application is well-known.</param>
 /// <param name="args">The arguments to be passed to the application during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="QtCmdLineAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public QtCmdLineAction(Id id, string appPath, string args, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, returnType, when, step, condition, sequence)
 {
     AppPath = appPath;
     Args = args;
     Name = "Action" + (++count) + "_QtCmdLine_" + IO.Path.GetFileName(appPath);
 }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagedAction"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="action">The full name of static CustomAction method.</param>
        /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly
        /// is in the Wix# script.</param>
        /// <param name="returnType">The return type of the action.</param>
        /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
        /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
        /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
        /// <param name="sequence">The MSI sequence the action belongs to.</param>
        /// <param name="rollback">The full name of static CustomAction rollback method.</param>
        public ManagedAction(CustomActionMethod action, string actionAssembly, Return returnType, When when, Step step, Condition condition, Sequence sequence, CustomActionMethod rollback)
            : base(returnType, when, step, condition, sequence)
        {
            string name = action.Method.Name;

            Name           = name;
            MethodName     = name;
            Rollback       = rollback.Method.Name;
            ActionAssembly = actionAssembly;
        }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="key">The key (file name) of the installed file to be executed.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="BinaryFileAction"/>.</param>
 public BinaryFileAction(string key, string args, Return returnType, When when, Step step, Condition condition)
     : base(returnType, when, step, condition)
 {
     Key = key;
     Args = args;
     Name = "Action" + (++count) + "_" + key;
 }
Пример #20
0
        void Bind <T>(Expression <Func <T> > expression, When when = When.Before, Step step = null, bool elevated = false)
        {
            var name    = Reflect.NameOf(expression);
            var handler = expression.Compile()() as Delegate;

            const string wixSharpProperties = "WIXSHARP_RUNTIME_DATA";

            if (handler != null)
            {
                if (this.AbortSetupOnUnhandledExceptions.HasValue)
                {
                    var abortOnErrorName = "WIXSHARP_ABORT_ON_ERROR";

                    if (!Properties.Any(p => p.Name == abortOnErrorName))
                    {
                        this.AddProperty(new Property(abortOnErrorName, this.AbortSetupOnUnhandledExceptions.Value.ToString()));
                    }
                }

                //foreach (string handlerAsm in handler.GetInvocationList().Select(x => x.Method.DeclaringType.Assembly.Location))
                foreach (var type in handler.GetInvocationList().Select(x => x.Method.DeclaringType))
                {
                    string location = type.Assembly.Location;

                    //Resolving scriptAsmLocation is not properly tested yet
                    bool resolveInMemAsms = true;

                    if (resolveInMemAsms)
                    {
                        if (location.IsEmpty())
                        {
                            location = type.Assembly.GetLocation();
                        }
                    }

                    if (location.IsEmpty())
                    {
                        throw new ApplicationException($"The location of the assembly for ManagedProject event handler ({type}) cannot be obtained.\n" +
                                                       "The assembly must be a file based one but it looks like it was loaded from memory.\n" +
                                                       "If you are using CS-Script to build MSI ensure it has 'InMemoryAssembly' set to false.");
                    }

                    if (!this.DefaultRefAssemblies.Contains(location))
                    {
                        this.DefaultRefAssemblies.Add(location);
                    }
                }

                this.AddProperty(new Property("WixSharp_{0}_Handlers".FormatWith(name), GetHandlersInfo(handler as MulticastDelegate)));

                string dllEntry = "WixSharp_{0}_Action".FormatWith(name);
                if (step != null)
                {
                    if (elevated)
                    {
                        this.AddAction(new ElevatedManagedAction(dllEntry)
                        {
                            Id             = new Id(dllEntry),
                            ActionAssembly = thisAsm,
                            Return         = Return.check,
                            When           = when,
                            Step           = step,
                            Condition      = Condition.Create("1"),
                            UsesProperties = "WixSharp_{0}_Handlers,{1},{2}".FormatWith(name, wixSharpProperties, DefaultDeferredProperties),
                        });
                    }
                    else
                    {
                        this.AddAction(new ManagedAction(dllEntry)
                        {
                            Id = new Id(dllEntry), ActionAssembly = thisAsm, Return = Return.check, When = when, Step = step, Condition = Condition.Create("1")
                        });
                    }
                }
            }
        }