【问题标题】:How to associate application with existing file types using WiX installer in a per-user installer?如何在每用户安装程序中使用 WiX 安装程序将应用程序与现有文件类型相关联?
【发布时间】:2012-04-18 11:37:48
【问题描述】:

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

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

不允许使用 HKLM 密钥

【问题讨论】:

    标签: installation wix windows-installer


    【解决方案1】:

    我相信这与每台机器的情况并没有什么不同。对于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

    【讨论】:

    • 好吧,你是对的。但是其他线程中描述的所有好东西(如 Vista/7 功能、打开方式、支持启动运行)呢?
    • @Roberto:如果这些功能通过将注册表项放入HKLM 中正常工作,并且我们假设它们也作为每个用户功能得到支持,那么从逻辑上讲,我的第一次尝试是把这些HKCU 下的注册表项。您甚至可以使用HKMU,wix 会根据需要自动解析为HKCUHKLM
    • @roberto:那么我猜这些功能不支持“每个用户”。
    • 好的,我不明白为什么(可能我做错了什么),但现在它正在工作
    【解决方案2】:

    我们开始.. 这应该适用于每个用户的应用程序,并提供您正在寻找的大部分好东西,除了 start > run 仅适用于每台机器。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-18
      • 1970-01-01
      • 1970-01-01
      • 2021-07-03
      • 1970-01-01
      • 2019-12-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多