WiX等效于;Regasm.exe my.dll/codebase“;?

WiX等效于;Regasm.exe my.dll/codebase“;?,wix,shell-extensions,regasm,Wix,Shell Extensions,Regasm,CodeProject有一个很好的解决方案 编译,运行Regasm.exe CSShellExtContextMenuHandler.dll/codebase,并且外壳扩展可用,它工作得非常好 但是要求用户运行Regasm对用户来说并不友好,因此我编写了下面的小WiX脚本。(刚刚复制了heat的输出,加上我想使用的依赖项DLL) 问题:安装生成的MSI时,外壳扩展名不会出现(在Windows资源管理器中,右键单击文件不会显示我的项目,尽管它使用的是Regasm) 我试图将Root=“HKCR

CodeProject有一个很好的解决方案

编译,运行Regasm.exe CSShellExtContextMenuHandler.dll/codebase,并且外壳扩展可用,它工作得非常好

但是要求用户运行
Regasm
对用户来说并不友好,因此我编写了下面的小WiX脚本。(刚刚复制了
heat
的输出,加上我想使用的依赖项DLL)

问题:安装生成的MSI时,外壳扩展名不会出现(在Windows资源管理器中,右键单击文件不会显示我的项目,尽管它使用的是
Regasm



我试图将
Root=“HKCR”Key=“[…]”
更改为
Root=“HKLM”Key=“SOFTWARE\Classes\[…]”
,以模拟Regasm实际安装的密钥,但这也不起作用。

首先,您使用的CLSID与原始示例源代码不同。也许你编辑它是为了让它成为你自己的。确保使用的值与
FileContextMenuExt
类上的属性相同

WiX的heat.exe似乎不支持codebase元素。可能的假设是,由于您正在计算机范围内注册COM程序集,因此您也会将其放在计算机范围内的程序集位置(即GAC)。如果这样做,就不需要代码库

heat file…
将生成除Codebase元素之外的所有内容,但我知道您是手工输入的。您还有其他必需的注册条目,
*\shellex\ContextMenuHandlers
。它是特定于应用程序的元素,因此无法生成。但是,你也是手工输入的

最后,安装程序和explorer.exe必须具有相同的“位属性”。否则,安装程序可能会为32位explorer.exe创建注册表项,而64位explorer.exe将看不到它们。要部署该产品,您必须拥有x86和X64版本的安装程序。您可以在
Wix/Product/package
元素中显式设置包的平台


除此之外,您的
Product.wxs
“在我的机器上工作。”

只是好奇手动创建的代码基元素是什么?
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>

  <Product Name='HelloWorld Shell Extension' Id='2afd44ab-16d7-40f4-8741-69ad546cb7cf' UpgradeCode='c5139d19-21ba-43c6-a17d-68760331f332'
    Language='1033' Codepage='1252' Version='0.4.4' Manufacturer='Me'>

    <Package Id='*' Keywords='Installer' Description="HelloWorld Shell Extension Setup" Manufacturer='Me'
      InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

    <Media Id='1' Cabinet='HelloWorldShellExtension.cab' EmbedCab='yes' DiskPrompt='HelloWorld CAB' />
    <Property Id='DiskPrompt' Value="HelloWorldShellExtension Bundle CAB Installation" />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
          <Directory Id='INSTALLDIR' Name='HelloWorldShellExtension'>
            <Component Id="cmpB0970E4FB9610FC20E1C6B6B2D45C606" Guid="7044db96-17d3-4d4f-93b0-135b89b042c8">
                <Class Id="{CE43A2AB-B457-49BF-C83F-4306208D438B}" Context="InprocServer32" Description="CSShellExtContextMenuHandler.FileContextMenuExt" ThreadingModel="both" ForeignServer="mscoree.dll">
                    <ProgId Id="CSShellExtContextMenuHandler.FileContextMenuExt" Description="CSShellExtContextMenuHandler.FileContextMenuExt" />
                </Class>
                <File Id="fil5B7C752C5541C807852A6781921F95AB" KeyPath="yes" Source="bin\CSShellExtContextMenuHandler.dll" />
                <RegistryValue Root="HKCR" Key="*\shellex\ContextMenuHandlers\{ce43a2ab-b457-49bf-c83f-4306208d438b}" Value="CSShellExtContextMenuHandler.FileContextMenuExt Class" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="Class" Value="CSShellExtContextMenuHandler.FileContextMenuExt" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="Assembly" Value="CSShellExtContextMenuHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73df467e0a99a326" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#fil5B7C752C5541C807852A6781921F95AB]" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="Class" Value="CSShellExtContextMenuHandler.FileContextMenuExt" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="Assembly" Value="CSShellExtContextMenuHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73df467e0a99a326" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="CodeBase" Value="file:///[#fil5B7C752C5541C807852A6781921F95AB]" Type="string" Action="write" />
            </Component>
            <Component Id='Libraries' Guid='f982a0bb-824d-4835-921d-e51b47b8598b'>
              <File Id='dependency.dll' Name='dependency.dll' Source='bin\dependency.dll' DiskId='1' />
            </Component>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id='HelloWorldShellExtensionFeature' Title='HelloWorld' Description='HelloWorld' Level='1' AllowAdvertise='no'>
      <ComponentRef Id="cmpB0970E4FB9610FC20E1C6B6B2D45C606" />
      <ComponentRef Id="Libraries" />
    </Feature>

    <UI>
      <UIRef Id="WixUI_InstallDir" />
    </UI>

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
  </Product>
</Wix>