如何使用 WiX 在开始菜单中创建多级子文件夹
如何使用 WiX 在 Windows 开始菜单中创建子文件夹(几级深)?
目前,我可以将快捷方式放在“开始”菜单中,但只能放在“程序”正下方的文件夹中(“开始”/“程序”/“MyFolder”),但我想将快捷方式嵌套得更深(“开始”/“程序”/“MyPlatform”/“MyProduct”/等)。 我尝试了不同的组合,但可惜。
<DirectoryRef Id="StartMenuMyProduct">
<Component Id="ApplicationShortcut" Guid="{PUT-SOME-GUID-HERE}">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="Configure My Product"
Description="Add or remove this and that"
Target="[MYPRODUCTDIR]ConfigureMyProduct.exe"
WorkingDirectory="MYPRODUCTDIR"/>
<RemoveFolder Id="StartMenuMyProduct"
On="uninstall"/>
<RemoveFolder Id="StartMenuMyPlatform"
On="uninstall"/>
<RegistryValue Root="HKCU"
Key="SOFTWARE\MyCompany\MyPlatform\My Product"
Name="Installed"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Shortcut to the configuration utility in the Windows Start menu -->
<Directory Id="ProgramMenuFolder">
<!--<Directory Id="StartMenuMyPlatform" Name="MyPlatform">-->
<Directory Id="StartMenuMyProduct" Name="My Product" />
<!--</Directory>-->
</Directory>
How do I create sub folders (several levels deep) in the Windows Start menu, using WiX?
Currently I am able to put my shortcut in the Start menu, but only in a folder immediately under Programs (Start / Programs / MyFolder), but I want to nest my shortcut deeper (Start / Programs / MyPlatform / MyProduct / etc.). I tried different combinations, but alas.
<DirectoryRef Id="StartMenuMyProduct">
<Component Id="ApplicationShortcut" Guid="{PUT-SOME-GUID-HERE}">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="Configure My Product"
Description="Add or remove this and that"
Target="[MYPRODUCTDIR]ConfigureMyProduct.exe"
WorkingDirectory="MYPRODUCTDIR"/>
<RemoveFolder Id="StartMenuMyProduct"
On="uninstall"/>
<RemoveFolder Id="StartMenuMyPlatform"
On="uninstall"/>
<RegistryValue Root="HKCU"
Key="SOFTWARE\MyCompany\MyPlatform\My Product"
Name="Installed"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Shortcut to the configuration utility in the Windows Start menu -->
<Directory Id="ProgramMenuFolder">
<!--<Directory Id="StartMenuMyPlatform" Name="MyPlatform">-->
<Directory Id="StartMenuMyProduct" Name="My Product" />
<!--</Directory>-->
</Directory>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有趣的是,MSI 要求创建一个注册表值,以检测该组件是否已安装。 如果我们希望为所有快捷方式只创建一个这样的注册表值,那么我们必须将所有快捷方式放在一个组件中。
幸运的是,可以通过使用 上的 Directory 属性来创建跨多个目标目录的组件快捷方式元素。
What makes things interesting is that MSI demands a registry value to be created as a way to detect whether the component has been installed. If we prefer to create only one such registry value for all shortcuts, then we'll have to put all our shortcuts in a single component.
Fortunately it is possible to create components which span multiple target directories by making use of the Directory attribute on the Shortcut element.