2010-05-21 46 views
13

Bạn có thể cho tôi biết, mã của tôi có vấn đề gì không?Biểu tượng cho phím tắt

<?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> 

tôi nhận được lỗi này và cảnh báo:

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

Tại sao? Tôi cung cấp cho tập tin ICO.

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

Bạn có ý tưởng gì không?

Trả lời

15

Bạn có vẻ thiếu phần tử Icon .. ví dụ:

<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

Khi tôi thêm yếu tố biểu tượng trên tôi nhận được lỗi sau. "Phần tử ComponentGroup chứa phần tử con không mong muốn 'Biểu tượng'." –

+0

@MARKANDBhatt Nó nằm trong phần tử Product. – JWiley

-1

Tôi đặt thẻ ở đầu danh sách của mình :) Tôi sử dụng biểu tượng từ tệp exe. Wix yêu cầu tiện ích tương tự cho file icon tập tin và tập tin của tôi (shortcut trên desktop)

Cảm ơn bạn Chú ý nào :)

11

Bạn phải có một phần mở rộng trên id của bạn Icon của ".exe" hoặc ".ico" .

Id Biểu tượng

= "Ikonka * .ico *" SourceFile = "Files \ AdministKOB.exe"/

+3

Đây là yêu cầu rất ngu ngốc của WiX. Đây là ngày thứ 2 của tôi bằng cách cố gắng giải quyết vấn đề tương tự. Cảm ơn bạn đã giải pháp. –

0

Bên cạnh đó, sở hữu biểu tượng của shortcut có thể mất một đường dẫn trực tiếp đến một exe hoặc file ico tuy nhiên, , không thể có bất kỳ khoảng trống nào trong tên tệp hoặc nó sẽ bị lỗi:

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

Làm việc sau đây cho tôi. Milage có thể thay đổi.

<?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

Nó rất dễ dàng:

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