Wix !(bind.AssemblyFullName.fileId)仅适用于gced程序集



祸不单行。为什么Wix让安装。net程序集变得如此困难!

我正在安装一个在。net中实现的COM Inprocess服务器,在我的Wix安装中,我需要为它创建注册表项。我不想这样做,我宁愿Wix有一个等效的RegAsm,但他们让我手动完成。我厌倦了因为暗示这有点晦涩难懂而被指责,所以我放弃了,试着像个好孩子一样,用声明的方式来表达。这是我的注册表现在的样子:

<File Id="filDriverAssembly" Source="$(var.TiGra.Astronomy.AWRDriveSystem.TargetPath)" KeyPath="yes" Vital="yes" Assembly=".net">
  <!--<Class Context="InprocServer32" Description="$(var.InstallName)" Id ="$(var.DriverGuid)" ThreadingModel ="both" >
    <ProgId Description="$(var.InstallName)" Id ="$(var.DriverId)" />
  </Class>-->
</File>
<RegistryKey Root="HKCR" Key="$(var.DriverId)"  Action="createAndRemoveOnUninstall">
  <RegistryValue Type="string" Value="$(var.DriverTypeName)"/>
  <RegistryKey Key="CLSID">
    <RegistryValue Type="string" Value="$(var.DriverGuid)" />
    <RegistryKey Key="$(var.DriverGuid)">
      <RegistryValue Type="string" Value="$(var.DriverTypeName)"/>
      <RegistryKey Key="InprocServer32">
        <RegistryValue Type="string" Value="mscoree.dll" />
        <RegistryValue Type="string" Name="ThreadingModel" Value="Both"/>
        <RegistryValue Type="string" Name="Class" Value="$(var.DriverTypeName)"/>
        <RegistryValue Type="string" Name="Assembly" Value="!(bind.AssemblyFullName.filDriverAssembly)"/>
        <RegistryValue Type="string" Name="RuntimeVersion" Value="2.0.50727"/>
        <RegistryValue Type="string" Name="CodeBase" Value="file:///[#filDriverAssembly]" />
        <RegistryKey Key="!(bind.fileVersion.filDriverAssembly)" >
          <RegistryValue Type="string" Name="Class" Value="$(var.DriverTypeName)"/>
          <RegistryValue Type="string" Name="Assembly" Value="!(bind.AssemblyFullName.filDriverAssembly)"/>
          <RegistryValue Type="string" Name="RuntimeVersion" Value="2.0.50727"/>
          <RegistryValue Type="string" Name="CodeBase" Value="file:///[#filDriverAssembly]" />
        </RegistryKey>
      </RegistryKey>
      <RegistryKey Key="ProgId">
        <RegistryValue Type="string" Value="$(var.DriverId)" />
      </RegistryKey>
      <RegistryKey Key="Implemented Categories">
        <RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" />
      </RegistryKey>
    </RegistryKey>
  </RegistryKey>
</RegistryKey>
<!-- Wow6432Node for x86 compatibility, installed only on x64 systems -->
<!-- HKEY_LOCAL_MACHINESOFTWAREClassesWow6432Node -->
<?if $(var.Win64) = "yes" ?>
<RegistryKey Root="HKCR" Key="Wow6432Node" Action="createAndRemoveOnUninstall">
  <RegistryKey Key="CLSID">
    <RegistryValue Type="string" Value="$(var.DriverGuid)" />
    <RegistryKey Key="$(var.DriverGuid)">
      <RegistryValue Type="string" Value="$(var.DriverTypeName)"/>
      <RegistryKey Key="InprocServer32">
        <RegistryValue Type="string" Value="mscoree.dll" />
        <RegistryValue Type="string" Name="ThreadingModel" Value="Both"/>
        <RegistryValue Type="string" Name="Class" Value="$(var.DriverTypeName)"/>
        <RegistryValue Type="string" Name="Assembly" Value="!(bind.AssemblyFullName.filDriverAssembly)"/>
        <RegistryValue Type="string" Name="RuntimeVersion" Value="2.0.50727"/>
        <RegistryValue Type="string" Name="CodeBase" Value="file:///[#filDriverAssembly]" />
        <RegistryKey Key="!(bind.assemblyVersion.filDriverAssembly)" >
          <RegistryValue Type="string" Name="Class" Value="$(var.DriverTypeName)"/>
          <RegistryValue Type="string" Name="Assembly" Value="!(bind.AssemblyFullName.filDriverAssembly)"/>
          <RegistryValue Type="string" Name="RuntimeVersion" Value="2.0.50727"/>
          <RegistryValue Type="string" Name="CodeBase" Value="file:///[#filDriverAssembly]" />
        </RegistryKey>
      </RegistryKey>
      <RegistryKey Key="ProgId">
        <RegistryValue Type="string" Value="$(var.DriverId)" />
      </RegistryKey>
      <RegistryKey Key="Implemented Categories">
        <RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" />
      </RegistryKey>
    </RegistryKey>
  </RegistryKey>
</RegistryKey>
<?endif ?>

RegAsm是为窝囊废准备的,不是吗?无论如何,请注意,我需要获得程序集的全名来创建一些注册表项。我使用的是绑定变量,特别是Value="!(bind.AssemblyFullName.filDriverAssembly)"

但是,除非我将属性Assembly=".net"添加到文件条目中,否则这不起作用。如果我不添加该属性,或者如果我使用Assembly="no",那么我得到

错误2未解析的绑定时间变量! (bind.AssemblyFullName.filDriverAssembly) .

当我将Assembly=".net"添加到文件项时,那么绑定器变量工作得很好,但是Wix将我的程序集放入全局程序集缓存中,这是不是我想要的!哦,老兄。

是不可能查询程序集的全名在Wix项目,如果它不进入GAC?为什么这两件事是相互依赖的?

除非文件被标记为程序集,否则它就像任何其他文件一样;WiX不知道它可能具有程序集属性。查看AssemblyApplication属性:您可以将其设置为适当的文件并设置@Assembly=".net",而无需告诉MSI该文件进入GAC。

相关内容

最新更新