wix-网站的快捷方式图标

wix-网站的快捷方式图标,wix,shortcut,favicon,Wix,Shortcut,Favicon,我是wix的新手。需要创建本地网站的快捷方式 它工作正常,并创建shorcuts,但它不会在开始菜单和桌面上显示任何图标。。。该网站有favicon文件,当我打开该网站时,我可以完美地看到它-我只是在快捷方式中看不到它。我试着用谷歌搜索它,但没有找到一个好的答案:InternetShortcut 我的代码是: <DirectoryRef Id="ApplicationProgramsFolder"> <Component Id="ApplicationShortcutBBB

我是wix的新手。需要创建本地网站的快捷方式

它工作正常,并创建shorcuts,但它不会在开始菜单和桌面上显示任何图标。。。该网站有favicon文件,当我打开该网站时,我可以完美地看到它-我只是在快捷方式中看不到它。我试着用谷歌搜索它,但没有找到一个好的答案:InternetShortcut

我的代码是:

<DirectoryRef Id="ApplicationProgramsFolder">
  <Component Id="ApplicationShortcutBBBApp" Guid="---">
    <util:InternetShortcut Id="ApplicationStartMenuShortcutBBBApp"
                    Name="BBB"
                    Target="http://localhost/BBB"/>
    <util:InternetShortcut Id="ApplicationDesktopShortcutBBBApp"
                    Name="BBB"
                    Directory="DesktopFolder"
                    Target="http://localhost/BBB"/>
    <RegistryValue Root="HKCU" Key="Software\Microsoft\BBB" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>
</DirectoryRef>


InternetShortcut不支持像普通快捷方式那样指定图标。这是有道理的。从技术上讲,Windows中的IUniformResourceLocator快捷方式不支持图标,尽管iShareLink快捷方式支持图标。

回答这个问题有点晚,但只需要做同样的事情。我采用的方法是使用iniFile元素写出一个url文件

这一方法有两点值得关注:

  • 由于快捷方式位于桌面上,图标文件位于文件系统的其他位置,因此我需要创建单独的组件来部署图标文件
  • 如果MSI作为普通用户运行且UAC打开,则不会为快捷方式设置图标。一旦我在安装前禁用了UAC,图标设置就正确了

    <Fragment>
    <DirectoryRef Id="DesktopFolder">
        <Component Id="ProductInternetShortcut" Guid="{YOUR_GUID_HERE}" >
            <IniFile Id="url_name"
                Action="addLine"
                Directory="DesktopFolder"
                Section="InternetShortcut"
                Name="ProductInternetShortcut.url"
                Key="URL"
                Value="https://my.url.com/" />
    
            <IniFile Id="url_target"
                Action="addLine"
                Directory="DesktopFolder"
                Section="InternetShortcut"
                Name="ProductInternetShortcut.url"
                Key="Target"
                Value="https://my.url.com/" />
    
            <IniFile Id="url_idlist"
                Action="createLine"
                Directory="DesktopFolder"
                Section="InternetShortcut"
                Name="ProductInternetShortcut.url"
                Key="IDList"
                Value=" " />
    
            <IniFile Id="url_HotKey"
                Action="addLine"
                Directory="DesktopFolder"
                Section="InternetShortcut"
                Name="ProductInternetShortcut.url"
                Key="HotKey"
                Value="0" />
    
            <IniFile Id="url_icon"
                Action="addLine"
                Directory="DesktopFolder"
                Section="InternetShortcut"
                Name="ProductInternetShortcut.url"
                Key="IconFile"
                Value="PATH_TO_ICON_FILE_ON_WORKSTATION" />
    
            <IniFile Id="url_iconIndex"
                Action="addLine"
                Directory="DesktopFolder"
                Section="InternetShortcut"
                Name="ProductInternetShortcut.url"
                Key="IconIndex"
                Value="0" />
    
            <RegistryValue Root="HKCU" Key="Software\COMPANY\PRODUCT" Name="installed" Type="integer" Value="1" KeyPath="yes" />
        </Component>
    </DirectoryRef>
    <DirectoryRef Id="ProductFolder">
        <Component Id="ShortcutIcons" Guid="{YOUR_GUID_HERE}">
            <File Id="filProductIcons" KeyPath="yes" Source="PATH_TO_ICON_FILE_ON_DEVELOPER_MACHINE" />
        </Component>
    </DirectoryRef>
    </Fragment>
    
    
    

  • 有一个更容易解决这个问题的办法。不使用InternetShortcut,您只需使用普通快捷方式并使用技巧将目标设置为url即可

    <SetProperty Id="URL" Value="http://yourpage.com" Sequence="execute"  Before="CreateShortcuts" />
    
    
    <Shortcut Directory="DesktopFolder" Id="WebShortcut" Name="Your Page" Description="Your Page Description" Target="[URL]" Icon="IconDesktop">
        <Icon Id="IconDesktop" SourceFile="images\icon.ico" />
    </Shortcut>
    
    
    
    “SetProperty”可以放在产品标签的某个位置。 应放置“快捷方式”而不是“Internet快捷方式”。 将属性[URL]作为目标非常重要。作为属性,它可以是url。直截了当地写着它不起作用。
    热/烛光/光中可能有警告,它们可以忽略。

    在Wix中,您可以通过创建带有图标的Internet快捷方式

    下面是我正在开发的一个应用程序的一个示例,它通过
    元素添加一个带有图标的网站链接,并将该链接同时放在桌面和“开始”菜单上

    注意,您可能必须将“util”前缀放在元素名称前面,就像这样,尽管我不必这样做:

    
    

    另外,请参见

    是否有其他方法定义网站快捷方式的图标?(使用wix)一个可能的解决方法似乎在提到的feature request@BobArnson中进行了描述。Internet快捷方式确实支持图标,但它们是通过
    IPropertySetStorage
    界面实现的,而不是
    IUniFormResourceCator
    。看,为我工作,看起来是最简单的解决办法。太棒了。谢谢这种方法比我刚刚花了30分钟的时间试图理解为什么它不创建任何URL快捷方式的
    util:InternetShortcut
    要清楚得多。