如何在每个用户的安装程序中使用WiX安装程序将应用程序与现有文件类型相关联?

时间:2012-04-18 11:37:48

标签: installer wix windows-installer

How to associate application with existing file types using WiX installer?How to register file types/extensions with a WiX installer?相关。

如果安装是按用户,我如何将应用程序与现有文件类型相关联?

不允许HKLM密钥

2 个答案:

答案 0 :(得分:5)

我认为这与每机器案例并没有什么不同。对于downmarker(每个用户安装),我把它放在安装应用程序可执行文件的组件中:

<!-- associate .md file extension with downmarker -->
<ProgId Id="DownMarker" Icon="downmarker.exe" 
    Description="Markdown Document">
    <Extension Id="md" >
       <Verb Id="open" Argument="&quot;%1&quot;"
          TargetFile="downmarker.exe" />
    </Extension>
</ProgId>

或者您可以查看full wxs file

答案 1 :(得分:3)

这里我们去..这应该适用于每个用户的应用程序,并提供您正在寻找的大多数好东西,除了开始&gt;运行只有每台机器。

<Icon Id="filetype.ico" SourceFile="filetype.ico" />
<Component Id="MyApp.exe" Directory="APPLICATIONFOLDER" Guid="*">
    <File Id="MyApp.exe" Name="MyApp.exe" KeyPath="yes"/>

    <Shortcut Id="startmenuShortcut" Directory="ProgramMenuFolder" Name="MyApp" Icon="$(var.product).ico" IconIndex="0" WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" />

    <!-- Capabilities keys for Vista/7 "Set Program Access and Defaults" -->
    <RegistryValue Root="HKCU" Key="SOFTWARE\MyApp\Capabilities" Name="ApplicationDescription" Value="!(loc.ApplicationDescription)" Type="string" />
    <RegistryValue Root="HKCU" Key="SOFTWARE\MyApp\Capabilities" Name="ApplicationIcon" Value="[APPLICATIONFOLDER]MyApp.exe,0" Type="string" />
    <RegistryValue Root="HKCU" Key="SOFTWARE\MyApp\Capabilities" Name="ApplicationName" Value="!(loc.ApplicationName)" Type="string" />
    <RegistryValue Root="HKCU" Key="SOFTWARE\MyApp\Capabilities\DefaultIcon" Value="[APPLICATIONFOLDER]MyApp.exe,1" Type="string" />
    <RegistryValue Root="HKCU" Key="SOFTWARE\MyApp\Capabilities\FileAssociations" Name=".xyz" Value="MyApp.Document" Type="string" />
    <RegistryValue Root="HKCU" Key="SOFTWARE\MyApp\Capabilities\MIMEAssociations" Name="application/xyz" Value="MyApp.Document" Type="string" />
    <RegistryValue Root="HKCU" Key="SOFTWARE\MyApp\Capabilities\shell\Open\command" Value="&quot;[APPLICATIONFOLDER]MyApp.exe&quot; &quot;%1&quot;" Type="string" />
    <RegistryValue Root="HKCU" Key="SOFTWARE\RegisteredApplications" Name="MyApp" Value="SOFTWARE\MyApp\Capabilities" Type="string" />

    <!-- Extend to the "open with" list + Win7 jump menu pinning  -->
    <RegistryValue Root="HKCR" Key="Applications\MyApp.exe\SupportedTypes" Name=".xyz" Value="" Type="string" />
    <RegistryValue Root="HKCR" Key="Applications\MyApp.exe\shell\open" Name="FriendlyAppName" Value="!(loc.ApplicationName)" Type="string" />

    <!-- MyApp.Document ProgID -->
    <RegistryValue Root="HKCR" Key="MyApp.Document" Name="FriendlyTypeName" Value="!(loc.DescXYZ)" Type="string" />
    <ProgId Id="MyApp.Document" Description="!(loc.DescXYZ)" Icon="filetype.ico" Advertise="yes">
        <Extension Id="xyz">
            <Verb Id="open" Command="!(loc.ExplorerMenuOpenXYZ)" Argument="&quot;%1&quot;" />
            <MIME Advertise="yes" ContentType="application/xyz" Default="yes" />
        </Extension>
    </ProgId>

    <!-- Optional: add an 'Edit with XYZ' to 'right click' even when not associated -->
    <RegistryValue Root="HKCR" Key="SystemFileAssociations\.xyz\shell\edit.MyApp.exe" Value="!(loc.ExplorerMenuEditXYZ)" Type="string" />
    <RegistryValue Root="HKCR" Key="SystemFileAssociations\.xyz\shell\edit.MyApp.exe\command" Value="&quot;[APPLICATIONFOLDER]MyApp.exe&quot; &quot;%1&quot;" Type="string" />
</Component>