Autogen guid (*) in Windowsinstaller cause ICE08 e

2019-07-25 16:47发布

问题:

Two component tags in my wxs file is as folllows

<Component Id="Comp.Comp1" Guid="*" >
<Condition><![CDATA[VersionNT < 602]]></Condition>
<File Id="File1" Source="$(Dir1)\TestFile.dll" />
 </Component>

<Component Id="Comp.Comp2" Guid="*" >
<Condition><![CDATA[VersionNT >= 602]]></Condition>
<File Id="File2" Source="$(Dir2)\TestFile.dll" />
 </Component>

But iam getting an error as below

ICE08: Component: Comp.Comp2 has a duplicate GUID: {2963D8E7-CBEC-50C8-AF4B-65E895FE3283}   

How iam getting this error eventhough i gave an autogen guid value "*"

Thanks,

回答1:

The star-GUID for Component elements calculates a stable GUID based on the target location of the file. The stability of the GUID is vital for future updates (particularly patching). It works great in many cases but mutually exclusive Components that put a file into the exact same location is not one. In this case, you'll need to explicitly set at least one of your Component/@Guids.

In the above case, you can do the following:

<Component Id="Comp.Comp1" Guid="*" >
    <Condition><![CDATA[VersionNT < 602]]></Condition>

    <File Id="File1" Source="$(Dir1)\TestFile.dll" />
</Component>

<Component Id="Comp.Comp2" Guid="PUT-GUID-HERE">
    <Condition><![CDATA[VersionNT >= 602]]></Condition>

    <File Id="File2" Source="$(Dir2)\TestFile.dll" />
</Component>

Technically speaking you could suppress the ICE08 error in this case because the Components are mutually exclusive but I, personally, would do the above before suppressing the ICE. IMHO, it is preferable that the different files have different GUIDs ultimately anyway.



回答2:

You didn't show the context of this snippet ( Directory Elements) but to me it seems you are installing the same filename to the same directory twice. That's a component rule violation. The "source" is different but the conditions are the same : !VersionNT >= 602.