通过 Wix 安装项目将应用程序添加到 "Choose A Default Browser"

Adding App to "Choose A Default Browser" via Wix Setup Project

我有一个应用程序,在 Windows 8.1 和 10 上安装后,我试图让它显示在“选择默认浏览器”中。我关注了另一个 link,并且能够通过 Wix 安装项目设置以下注册表项。所有密钥都是在安装时创建的,但是,该应用程序不会显示在 Web 浏览器列表中。有人知道我错过了什么吗?

<Fragment>
<DirectoryRef Id="TARGETDIR">
  <Component Id="RegistryEntries" Guid="8b810d67-345d-4652-bf17-a503d120cccc">
    <RegistryKey Root="HKLM"
                 Key="Software\MyApp"
                 Action="createAndRemoveOnUninstall">
      <RegistryKey Key="Capabilities"
                   Action="createAndRemoveOnUninstall">
        <RegistryValue Type="string" Name="ApplicationName" Value="MyApp"/>
        <RegistryValue Type="string" Name="ApplicationIcon" Value="C:\Program Files (x86)\MyApp\MyApp.exe,0"/>
        <RegistryValue Type="string" Name="ApplicationDescription" Value="A safe browsing experience."/>
          <RegistryKey Key="FileAssociations"
                       Action="createAndRemoveOnUninstall">
            <RegistryValue Type="string" Name=".htm" Value="MyApp"/>
            <RegistryValue Type="string" Name=".html" Value="MyApp"/>
            <RegistryValue Type="string" Name=".shtml" Value="MyApp"/>
            <RegistryValue Type="string" Name=".xht" Value="MyApp"/>
            <RegistryValue Type="string" Name=".xhtml" Value="MyApp"/>
          </RegistryKey>
          <RegistryKey Key="URLAssociations"
                     Action="createAndRemoveOnUninstall">
              <RegistryValue Type="string" Name="http" Value="MyApp"/>
              <RegistryValue Type="string" Name="https" Value="MyApp"/>
              <RegistryValue Type="string" Name="ftp" Value="MyApp"/>
          </RegistryKey>
      </RegistryKey>
    </RegistryKey>
    <RegistryKey Root="HKLM"
                 Key="SOFTWARE\RegisteredApplications"
                 Action="none">
      <RegistryValue Type="string" Name="MyApp" Value="Software\MyApp\Capabilities"/>
    </RegistryKey>
    <RegistryKey Root="HKLM"
                 Key="Software\Classes\MyApp"
                 Action="createAndRemoveOnUninstall">
      <RegistryValue Type="string" Value="MyApp Document"/>
      <RegistryKey Key="shell"
                   Action="createAndRemoveOnUninstall">
        <RegistryKey Key="open"
                             Action="createAndRemoveOnUninstall">
          <RegistryKey Key="command"
                               Action="createAndRemoveOnUninstall">
            <RegistryValue Type="string" Name="MyApp" Value="&quot;C:\Program Files (x86)\MyApp\MyApp.exe&quot; &quot;%1&quot;"/>
          </RegistryKey>
        </RegistryKey>
      </RegistryKey>
    </RegistryKey>
  </Component>
</DirectoryRef>

如果您发现遗漏的元素,请告诉我。

我想出来了,所以我想我会继续 post 给你们的答案。在“Software\Classes\MyApp\shell\open”中创建“命令”键时,我必须删除注册表值的“名称”,以便将我的注册表值写入“(默认)”字符串。

<RegistryKey Key="command"
             Action="createAndRemoveOnUninstall">
            <RegistryValue Type="string" Value="&quot;C:\Program Files 
               (x86)\MyApp\MyApp.exe&quot; &quot;%1&quot;"/>

所以我在 Product.wxs 文件中创建所有密钥的最终工作代码,以及我在“选择 Web 浏览器”部分中的应用程序是:

<Fragment>
<DirectoryRef Id="TARGETDIR">
  <Component Id="RegistryEntries" Guid="8b810d67-345d-4652-bf17-a503d120cccc">
    <RegistryKey Root="HKLM"
                 Key="Software\MyApp"
                 Action="createAndRemoveOnUninstall">
      <RegistryKey Key="Capabilities"
                   Action="createAndRemoveOnUninstall">
        <RegistryValue Type="string" Name="ApplicationName" Value="MyApp"/>
        <RegistryValue Type="string" Name="ApplicationIcon" Value="C:\Program Files (x86)\MyApp\MyApp.exe,0"/>
        <RegistryValue Type="string" Name="ApplicationDescription" Value="A safe browsing experience."/>
          <RegistryKey Key="FileAssociations"
                       Action="createAndRemoveOnUninstall">
            <RegistryValue Type="string" Name=".htm" Value="MyApp"/>
            <RegistryValue Type="string" Name=".html" Value="MyApp"/>
            <RegistryValue Type="string" Name=".shtml" Value="MyApp"/>
            <RegistryValue Type="string" Name=".xht" Value="MyApp"/>
            <RegistryValue Type="string" Name=".xhtml" Value="MyApp"/>
          </RegistryKey>
          <RegistryKey Key="URLAssociations"
                     Action="createAndRemoveOnUninstall">
              <RegistryValue Type="string" Name="http" Value="MyApp"/>
              <RegistryValue Type="string" Name="https" Value="MyApp"/>
              <RegistryValue Type="string" Name="ftp" Value="MyApp"/>
          </RegistryKey>
      </RegistryKey>
    </RegistryKey>
    <RegistryKey Root="HKLM"
                 Key="SOFTWARE\RegisteredApplications"
                 Action="none">
      <RegistryValue Type="string" Name="MyApp" Value="Software\MyApp\Capabilities"/>
    </RegistryKey>
    <RegistryKey Root="HKLM"
                 Key="Software\Classes\MyApp"
                 Action="createAndRemoveOnUninstall">
      <RegistryValue Type="string" Value="MyApp Document"/>
      <RegistryKey Key="shell"
                   Action="createAndRemoveOnUninstall">
        <RegistryKey Key="open"
                             Action="createAndRemoveOnUninstall">
          <RegistryKey Key="command"
                               Action="createAndRemoveOnUninstall">
            <RegistryValue Type="string" Value="&quot;C:\Program Files (x86)\MyApp\MyApp.exe&quot; &quot;%1&quot;"/>
          </RegistryKey>
        </RegistryKey>
      </RegistryKey>
    </RegistryKey>
  </Component>
</DirectoryRef>