If you need to generate multiple components (each for a different instance)
with a specific GUID, you don't need to have an additional feature request.
You can use pre-processor extension. I put it together:

define specific GUIDS for each instance

<?define GUID_0001.INSTANCE01 = '*** real guid ***' ?>
<?define GUID_0001.INSTANCE02 = '*** real guid ***' ?>
<?define GUID_0001.INSTANCE03 = '*** real guid ***' ?>

<?define GUID_0002.INSTANCE01 = '*** real guid ***' ?>
<?define GUID_0002.INSTANCE02 = '*** real guid ***' ?>
<?define GUID_0002.INSTANCE03 = '*** real guid ***' ?>

define instance list

<?define InstanceIDList=01;02;03 ?>

define components using foreach loop - with condition
<?foreach INST in $(var.InstanceIDList)?>
        <Component Id='cmpId$(var.INST)'
Guid='$(instance_tools.GetGUIDVariable(0001, $(var.INST)))'>
                <File Id='fileId$(var.INST)_01' Name='....' DiskId='1' 
Source='...'
KeyPath='yes'>
                </File>
                <Condition></Condition>
        </Component>
<?endforeach?>

Please note there is a special "instance_tools.GetGUIDVariable"
pre-processor call used. This is written in a separate DLL (c#) as a
pre-processor extension. Purpose of this is to compute the name of GUID
variable to be used. This cannot be done in WIX directly (as of 3.5). The
code looks like this:

public class CIPPWIXExtension : PreprocessorExtension
    {

        private static string[] prefixes = { "instance_tools" };
        public override string[] Prefixes { get { return prefixes; } }

        public override string EvaluateFunction(string prefix, string
function, string[] args)
        {
            string result = null;
            switch (prefix)
            {
                case "instance_tools":
                    switch (function)
                    {
                        case "GetGUIDVariable":
                            if (args.Length == 2)
                            {
                                //0 - GUID ID
                                //1 - Instance ID
                                string var_name = ("GUID_" + args[0] +
".INSTANCE" + args[1]);
                                string res =
this.Core.GetVariableValue(null, "var", var_name);
                                if (String.IsNullOrEmpty(res))
                                    return "[No such variable found: " +
var_name + "]";
                                else
                                    return res;
                            }
                            else
                            {
                                result = String.Empty;
                            }
                            break;
                    }
                    break;
            }
            return result;
        }
}

--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Multiple-Instance-Transforms-Walkthrough-Proposed-Simple-Addition-to-WiX-to-Make-Them-Easier-tp708828p7114938.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to