2012-06-21 228 views
6

我是wix新手。需要创建一个本地网站的快捷方式。wix - 网站的快捷方式图标

它工作正常,并创建shorcuts,但它不显示任何图标在开始菜单和桌面上...该网站有favicon文件,当我打开该网站,我可以看到它完美 - 我只是不在快捷方式中看到它。我试图谷歌,但我没有找到util的一个很好的答案: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> 

回答

1

InternetShortcut不支持指定像一个正常的快捷方式的图标。有一个open feature request。从技术上讲,Windows中的IUniformResourceLocator快捷方式不支持图标,尽管IShellLink快捷方式可以。

+0

是否有任何其他方式来定义网站快捷方式的图标? (With wix) – TamarG

+1

可能的解决方法似乎在提到的功能请求@BobArnson中进行了描述。 –

+0

谢谢大家,它的工作:) – TamarG

0

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

两点这种方法的兴趣:

  1. 由于该快捷方式是在桌面上的图标文件所在的文件系统上的其他地方,我需要创建单独的组件部署图标文件。
  2. 如果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> 
    
13

没有为这个问题的简单的解决方案。而不是使用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”可以放置在产品标签的某个位置。 应该放置“Shortcut”而不是“InternetShortcut”。 将属性[URL]作为目标非常重要。作为一个属性,它可以是一个网址。直接写它doese不工作。 可能会有警告在加热/蜡烛/灯光下,可以忽略。

+0

为我工作,看起来像最简单的解决方案。 –

+0

爱这真的很简单的解决方案,谢谢! – Anheledir

+0

太棒了。谢谢。这种方法比我刚刚杀死30分钟的'util:InternetShortcut'更清晰,试图了解它为什么不创建任何URL快捷方式。 – c00000fd