不好意思回答我自己的问题。
最近,我偶然发现了有关DISABLEADVTSHORTCUTS属性的信息。我使用公告的快捷方式创建了一个安装,并将DISABLEADVTSHORTCUTS属性设置为1,这会生成非公告的快捷方式。这绕过了ICE43错误因为广告的快捷方式可以使用文件作为键所以。由于已设置DISABLEADVTSHORTCUTS,因此Windows Installer会将这些广告发布的快捷方式替换为常规快捷方式。
我将Package Element的InstallScope属性设置为“ perMachine”。这会将ALLUSERS属性设置为1。然后,ProgramMenuFolder和DesktopFolder的值将解析为“所有用户”配置文件。
对于在ProgramMenuFolder下创建的文件夹,有一个RemoveFolder和RegistryValue元素。我看到的示例(ex1,ex2)使用HKCU作为RegistryValue的根。我将此根目录更改为HKMU,这取决于ALLUSERS的值而解析为HKCU或HKLM。
简而言之,将DISABLEADVTSHORTCUTS设置为1时,您发布的快捷方式不会产生ICE错误,但是在安装后将转换为非发布的快捷方式。带有根HKMU的RegistryValue对于密钥路径来说是合适的,只要它不是非广告快捷方式的密钥路径即可。
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Foobar 1.0" Id="YOURGUID-21F1-4026-ABD2-7CC7F8CE4D18" UpgradeCode="YOURGUID-AFA4-46C6-94AA-EEE3D104F903" Language="1033" Codepage="1252" Version="1.0.0" Manufacturer="Acme Ltd.">
<Package Id="*" Keywords="Installer" Description="Acme's Foobar 1.0 Installer" Comments="Foobar is a registered trademark of Acme Ltd." Manufacturer="Acme Ltd." InstallerVersion="100" Languages="1033" Compressed="yes" SummaryCodepage="1252" InstallScope="perMachine" />
<Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1" />
<Property Id="DiskPrompt" Value="Acme's Foobar 1.0 Installation [1]" />
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="Acme" Name="Acme">
<Directory Id="INSTALLDIR" Name="Foobar 1.0">
<Component Id="MainExecutable" Guid="YOURGUID-3E4F-47A2-86F1-F3162E9C4798">
<File Id="FoobarEXE" Name="FoobarAppl10.exe" DiskId="1" Source="FoobarAppl10.exe" KeyPath="yes">
<Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="Foobar 1.0" WorkingDirectory="INSTALLDIR" Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
<Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Name="Foobar 1.0" WorkingDirectory="INSTALLDIR" Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
</File>
</Component>
<Component Id="HelperLibrary" Guid="YOURGUID-C7DA-4C02-A2F0-A6E089FC0CF3">
<File Id="HelperDLL" Name="Helper.dll" DiskId="1" Source="Helper.dll" KeyPath="yes" />
</Component>
<Component Id="Manual" Guid="YOURGUID-FF92-4BF4-A322-819A3B2265A0">
<File Id="Manual" Name="Manual.pdf" DiskId="1" Source="Manual.pdf" KeyPath="yes">
<Shortcut Id="startmenuManual" Directory="ProgramMenuDir" Name="Instruction Manual" Advertise="yes" />
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Foobar 1.0">
<Component Id="ProgramMenuDir" Guid="YOURGUID-D1C2-4D76-BA46-C6FA79862E77">
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
<RegistryValue Root="HKMU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id="Complete" Level="1">
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="HelperLibrary" />
<ComponentRef Id="Manual" />
<ComponentRef Id="ProgramMenuDir" />
</Feature>
<Icon Id="Foobar10.exe" SourceFile="FoobarAppl10.exe" />
</Product>
</Wix>