使用WiX创建桌面快捷方式 [英] Create shortcut to desktop using WiX

查看:172
本文介绍了使用WiX创建桌面快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在Wix中有此安装项目,并希望在桌面上有一个快捷方式. 您可能认为这很容易.但事实并非如此. 在Internet上找到的所有代码段均无效. 经过数小时的努力和阅读文档,我终于理解正确了,所以我在这里与您分享.

So I have this setup project in Wix and wanted to have a shortcut on the desktop. This must be easy you might think. But that is not the case. All the code snippets found on the Internet did not work. After a few hours of struggling and reading the documentation I finally got it right, so I am sharing it with you here.

推荐答案

快捷方式是不公开的,希望对您有所帮助. 记住将组件放在功能标签中.

The shortcut is a non-advertised one, hope this helps someone. Remember to put the component in your feature tag.

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="DesktopFolder" Name="Desktop">
        <Component Id="ApplicationShortcutDesktop" Guid="*">
            <Shortcut Id="ApplicationDesktopShortcut"
                Name="Text under your icon"
                Description="Comment field in your shortcut"
                Target="[MYAPPDIRPROPERTY]MyApp.exe"
                WorkingDirectory="MYAPPDIRPROPERTY"/>
            <RemoveFolder Id="DesktopFolder" On="uninstall"/>
            <RegistryValue
                Root="HKCU"
                Key="Software\MyCompany\MyApplicationName"
                Name="installed"
                Type="integer"
                Value="1"
                KeyPath="yes"/>
        </Component>
    </Directory>

    <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="MyCompany" Name="MyCompany">
            <Directory Id="MYAPPDIRPROPERTY" Name="MyAppName">
                <!-- main installation files -->
            </Directory>
        </Directory>
    </Directory>
</Directory>

这篇关于使用WiX创建桌面快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆