2010-05-21 129 views
13

您能告诉我,我的代码有什么问题吗?快捷方式图标

<?xml version="1.0" encoding="utf-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension" xmlns:html="http://www.w3.org/1999/xhtml"> 
    <Product Id="c1ee1e1f-4e2a-41c6-a716-eb6f79477012" Name="AdministKOB" Language="1033" Version="1.0.0.0" Manufacturer="Project UP" UpgradeCode="909b9926-711d-4a97-887b-df0bafc6ea66"> 
     <Package InstallerVersion="200" Compressed="yes" /> 
     <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> 

     <Icon Id="ikonka" SourceFile="Files\AdministKOB.exe"/> 

     <Directory Id="TARGETDIR" Name="SourceDir"> 
      <Directory Id="DesktopFolder"/> 
      <Directory Id="ProgramMenuFolder"> 
      </Directory> 

      <Directory Id="ProgramFilesFolder"> 
       <Directory Id="INSTALLLOCATION" Name="Administ_KOB"> 
        <Component Id="ProductComponent" Guid="6bd37582-5219-4ae4-a56e-cd1ecd375efa"> 
         <File Id="AdministKOB" Name="AdministKOB.exe" Source="Files\AdministKOB.exe" KeyPath="yes"> 
         <Shortcut Advertise="yes" 
             Id="DesktopShortcut" 
             Directory="DesktopFolder" 
             Name="AdministKOB" 
             WorkingDirectory="INSTALLDIR" 
             Description="Elektroniczna ksiazka budynku" 
             Icon ="ikonka"> 
         </Shortcut> 
         </File> 
         <!--<File Id="ikonka" Name="C.ico" DiskId="1" Source="City.ico" Vital="yes" />--> 
        </Component> 
       </Directory> 
      </Directory> 
     </Directory> 

     <Feature Id="ProductFeature" Title="AdministKOB" Level="1"> 
      <ComponentRef Id="ProductComponent" /> 
     </Feature> 
     <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" /> 
    </Product> 
</Wix> 

我得到这个错误和警告:

The extension of Icon 'ikonka' for Shortcut 'DesktopShortcut' is not "exe" or "ico". The Icon will not be displayed correctly.*

为什么?我给ICO文件。

The extension of Icon 'ikonka' for Shortcut 'DesktopShortcut' does not match the extension of the Key File for component 'ProductComponent'.

你有什么想法吗?

回答

15

您似乎缺少Icon元素。

<Icon Id="City.ico" SourceFile="City.ico" /> 
    <Component ...> 
     <File ...> 
      <Shortcut Advertise="yes" 
       Id="DesktopShortcut" 
       Directory="DesktopFolder" 
       Name="AdministKOB" 
       WorkingDirectory="INSTALLDIR" 
       Description="Elektroniczna książka budynku" 
       Icon ="City.ico" /> 
     </File> 
    </Component> 
+2

当我添加上述我获得以下错误图标元素。 “ComponentGroup元素包含一个意外的子元素'Icon'。” – 2014-07-20 16:40:19

+0

@MARKANDBhatt它属于Product元素。 – JWiley 2016-01-06 15:41:50

-1

我把标签上我的房源顶部:) 我使用的图标从exe文件。维克斯需要的文件图标文件相同的扩展和我的文件(在桌面快捷方式)

感谢您的注意力放在:)

11

您必须对“.EXE”或“.ICO”你的图标ID相关的扩展。

图标ID = “ikonka * .ICO *” 的SourceFile = “文件\ AdministKOB.exe”/

+3

这是WiX非常愚蠢的要求。这是我第二天试图解决同样的问题。感谢您的解决方案。 – 2014-06-10 09:04:35

0

此外,该快捷方式的图标属性可以直接路径EXE或ICO文件然而, ,文件名中不能有空格,否则会出错:

The Shortcut/@Icon attribute's value, '"C:\Users\yadayadayada\Data Migration.exe', is not a 
legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores 
(_), or periods (.). Every identifier must begin with either a letter or an underscore.  
SetupProject C:\Users\yadayadayada\SetupProject\Product.wxs 53 
0

以下为我工作。米格可能会有所不同。

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
<Fragment> 
<Icon Id="dbwizard.ico" SourceFile="dbwizard.ico" /> 
<ComponentGroup Id="DBWizardComponentGroup" Directory="INSTALLFOLDER"> 
    <Component Id="FakeDBWizard_exe" Guid="{2008318F-8628-411E-B1B9-BC92989BCD19}"> 
    <File Id="FakeDBWizard_exe" 
      Name="FakeDBWizard_exe" 
      Source="database\FakeDBWizard.exe" 
      KeyPath="yes"> 
     <Shortcut Id="DBWizardShortcut" 
       Directory="Otter32ShortcutDir" 
       Name="Otter Database Wizards" 
       Description="Database Wizards for ABCSystem32" 
       WorkingDirectory="INSTALLFOLDER" 
       Advertise="yes" 
       Icon="dbwizard.ico" /> 
1

这是很容易:

<Shortcut Directory="DesktopFolder" Id="DesktopShortcut" Name="YourApp" Description="DescriptionOfYourApp" Target="http://localhost/" Icon="YourAppIcon"> 
     <Icon Id="YourAppIcon" SourceFile="$(var.BinDir)\favicon.ico" /> 
</Shortcut>