2009-03-12 22 views

Trả lời

6

Đây là cách tôi đã làm. Tôi tuyên bố:

<Icon Id="Icon.exe" SourceFile="..\Installer\Graph.ico" /> 

trước </Product> và thêm nó như là một tài liệu tham khảo như sau:

<ProgId Id='myApp.exe' Description='Some description' Advertise='yes' Icon='Icon.exe'> 
      <Extension Id='xyz' ContentType='application/text'> 
      <Verb Id='open' Sequence='10' Command='Open' Argument='"%1"' /> 
      </Extension> 
</ProgId> 
7

TỪ: http://www.tramontana.co.hu/wix/lesson1.php#1.7

Nếu ứng dụng của bạn xử lý loại tập tin dữ liệu riêng của mình, bạn sẽ cần phải đăng ký một hiệp hội tập tin cho nó. Đặt một ProgId bên trong thành phần của bạn. FileId nên tham chiếu đến thuộc tính Id của phần tử Tệp mô tả tệp có nghĩa là để xử lý các tệp của tiện ích mở rộng này. Lưu ý các dấu chấm than: nó sẽ trở lại con đường ngắn của tập tin thay vì lâu nhất:

<ProgId Id='AcmeFoobar.xyzfile' Description='Acme Foobar data file'> 
    <Extension Id='xyz' ContentType='application/xyz'> 
    <Verb Id='open' Sequence='10' Command='Open' Target='[!FileId]' Argument='"%1"' /> 
    </Extension> 
</ProgId> 

Để gán một biểu tượng để loại tập tin này, bạn phải xác định đăng ký phù hợp các entry bản thân bên trong thành phần của bạn:

<Registry Id='FooIcon1' Root='HKCR' Key='.xyz' Action='write' 
    Type='string' Value='AcmeFoobar.xyzfile' /> 
<Registry Id='FooIcon2' Root='HKCR' Key='AcmeFoobar.xyzfile' Action='write' 
    Type='string' Value='Acme Foobar data file' /> 
<Registry Id='FooIcon3' Root='HKCR' Key='AcmeFoobar.xyzfile\DefaultIcon' Action='write' 
    Type='string' Value='[INSTALLDIR]Foobar.exe,1' /> 
+1

Và những gì hiện các Foobar.exe bên Value = '[InstallDir] Foobar.exe, 1' /> tham khảo? Và nơi nó cư trú? – Filip

+0

liên kết đã chết – DonDon

0

tôi khuyên bạn nên sau tràn bài chồng tôi nằm here cho cách đơn giản và thanh lịch nhất của nhúng vào biểu tượng một tài nguyên mà không cần một dự án C++ trong một ứng dụng .NET được quản lý.

Tiếp theo, đây là cách thích hợp để thiết lập này qua wix:

<Component Id="stackoverflowFileRegistration" Guid="MY_GUID"> 

    <RegistryKey Root="HKCR" Key=".stackoverflow" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> 
     <RegistryValue Value="stackoverflow.Document" Type="string" KeyPath="yes" /> 
     <RegistryValue Name="Content Type" Value="application/stackoverflow" Type="string" /> 
     <RegistryKey Key="ShellNew" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> 
     <RegistryValue Name="NullFile" Value="" Type="string" /> 
     <RegistryValue Name="Data" Value="Default new document Content.. NOTE: you must use a MutiStringValue nodes for multi-line content...." Type="string"/> 
     </RegistryKey> 
    </RegistryKey> 

    <RegistryKey Root="HKCR" Key="stackoverflow.Document" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> 
     <RegistryValue Value="stackoverflow Document" Type="string" /> 

     <RegistryKey Key="DefaultIcon" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> 
     <RegistryValue Value="[INSTALLDIR]bin\stackoverflow.lib.dll, 1" Type="string" /> 
     </RegistryKey> 

     <RegistryKey Key="Shell" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> 
     <RegistryKey Key="openstackoverflowwebsite" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> 
      <RegistryValue Value="Open Stackoverflow" Type="string" /> 
      <RegistryKey Key="command" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> 
      <RegistryValue Value="&quot;[INSTALLDIR]stackoverflow.exe&quot; /openwebsite &quot;%1&quot;" Type="string" /> 
      </RegistryKey> 
     </RegistryKey> 
     </RegistryKey> 

    </RegistryKey> 
    </Component> 

mẫu này đăng ký vào biểu tượng mặc định cho một phần mở rộng tập tin cụ thể (.stackoverflow) mà nằm trong một assembly từ bước 1. Nó cũng cho thấy cách tạo các lệnh nhấp chuột phải của Windows Explorer cũng như thêm một mục trình đơn vào menu phụ Windows Explorer Mới.

Cảm ơn

-Blake Niemyjski

+0

Mã này hoạt động như WIX 3.6 ... –

Các vấn đề liên quan