簡體   English   中英

Wix:如何在64位計算機上寫入32位寄存器

[英]Wix: How to write to 32bit registers on 64 bit machine

我一直在尋找解決方案,但沒有成功。 我必須承認我是wix的乞be。 我有一個針對x86和x64單獨編譯的項目(WPF + caliburn,使用Visual Studio 2015)。 我使用x64機器創建兩個MSI。 不幸的是,在安裝過程中,安裝程序始終會寫入64位寄存器,這會導致應用程序出現問題。

我創建了以下組件,試圖使用Win64 =“ no”條目修復它,不幸的是沒有成功。 可以請建議正確的組件配置嗎?

<DirectoryRef Id="TARGETDIR">
  <?if $(var.Platform)="x64"?> 
          <Component Id="Registry_DefaultStoragePath" Guid="123-456-789" Win64="yes">
              <RegistryKey Root="HKLM"
                                       Key="Software\KeyName" Action="createAndRemoveOnUninstall">
                  <RegistryValue Type="string" Name="DefaultStorageLocation" Value="[DEFAULTSTORAGE]" KeyPath="yes"/>
              </RegistryKey>
          </Component>

          <Component Id="Registry_InstallType" Guid="123-456-789" Win64="yes">
              <RegistryKey Root="HKLM"
                                       Key="Software\KeyName" Action="createAndRemoveOnUninstall" >
                  <RegistryValue Type="string" Name="InstallType" Value="[INSTALLTYPE]" KeyPath="yes"/>
              </RegistryKey>
          </Component>
  <?endif?>
  <?if $(var.Platform)="x86"?> 
          <Component Id="Registry_DefaultStoragePath" Guid="132-456-789" Win64="no">
              <RegistryKey Root="HKLM"
                                       Key="Software\KeyName" Action="createAndRemoveOnUninstall">
                  <RegistryValue Type="string" Name="DefaultStorageLocation" Value="[DEFAULTSTORAGE]" KeyPath="yes"/>
              </RegistryKey>
          </Component>

          <Component Id="Registry_InstallType" Guid="123-456-789" Win64="no">
              <RegistryKey Root="HKLM"
                                       Key="Software\KeyName" Action="createAndRemoveOnUninstall" >
                  <RegistryValue Type="string" Name="InstallType" Value="[INSTALLTYPE]" KeyPath="yes"/>
              </RegistryKey>
          </Component>
  <?endif?>    

主要問題是<?if $(var.Platform)="x64"?>由預處理器處理,因此在編譯時而不是運行時進行評估。

為了處理x86 / x64運行時,您可以執行以下操作:

<component ....>
  <condition>NOT VersionNT64</condition>
  <!-- 32 bit component -->
  <!-- Add component content here -->
</component>
<component ....>
  <condition>VersionNT64</condition>
  <!-- 64 bit component -->
  <!-- Add component content here -->
</component>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM