2010-06-18 58 views
4

我有一個項目使用WiX擴展WixUtilExtension爲我們的Windows服務創建用戶。當我修補安裝(使用.msp)時,執行自定義操作RemoveUser和CreateUser。如何防止在修補程序中刪除和創建Windows用戶

我不希望這些WiX擴展創建自定義操作在補丁期間運行。

我可以直接向MSI的InstallExecuteSequence表中的自定義動作(ConfigureUsers)添加一個條件來防止這種情況發生,但是我還沒有找到在WiX中處理這種情況的方法。

使用WiX,如何防止在補丁期間執行RemoveUser和CreateUser?

<util:Group Id="LocalAdministrators" Name="Administrators"/> 
<DirectoryRef Id="INSTALLLOCATION" DiskId="1"> 
    <Component Id="CreateServiceAccountUser" Guid="{614550A7-C766-4B5D-9BF9-233D07EB3B69}"> 

     <util:User Id="ServiceAccountUser" 
        CanNotChangePassword="yes" 
        CreateUser="yes" 
        Disabled="no" 
        FailIfExists="no" 
        LogonAsService="yes" 
        Name="TestUser" 
        Password="testuserpw" 
        PasswordExpired="no" 
        PasswordNeverExpires="yes" 
        RemoveOnUninstall="yes" 
        UpdateIfExists="yes"> 
      <util:GroupRef Id="LocalAdministrators"/> 
     </util:User> 

     <RegistryKey Root="HKMU" Key="Software\AMT\WebBrix"> 
      <RegistryValue Name="CreateServiceAccountUser" 
          Value="Common" 
          Type="string" 
          KeyPath="yes" /> 
     </RegistryKey> 

    </Component> 
</DirectoryRef> 

回答

3

你可以做,在維克斯:

<InstallExecuteSequence> 
    <Custom Action='ConfigureUsers' 
      After='InstallFinalize'>NOT Installed</Custom> 
</InstallExecuteSequence> 

這裏有一些條件

  1. 行動只運行在安裝 條件:正確安裝和打補丁
  2. 行動只在移除MSI期間運行 條件:REMOVE
  3. 操作過程中運行安裝和維修 條件:不得取下
  4. 操作運行過程中安裝和刪除 條件:必須有沒有條件
  5. 行動呼籲EXE微星 條件安裝:正確安裝和打補丁
  6. 運行僅在初始安裝時: 未安裝
  7. 在初始安裝或選擇修復時運行。 未安裝或MaintenanceMode =「修改」
  8. 從命令行或添加/刪除菜單卸載時運行。 REMOVE〜=「All」或MaintenanceMode =「Remove」
+0

這會覆蓋wix自定義操作直接寫入msi InstallExecuteSequence表的條目嗎? 在InstallExecuteSequence標記中沒有此自定義操作的條目。它看起來像wix自定義操作直接將它添加到msi InstallExecuteSequence表。 – 2010-06-21 14:36:04

+0

如果我正確理解你,那麼不,這只是指定何時和如果行動應該發生。 – 2010-06-21 14:47:56

+0

也許更清楚些: 我使用wix WixUtilExtension庫來創建用戶,並且沒有爲ConfigureUsers自定義操作添加一個條目到InstallExecuteSequence標籤。我不知道這個自定義操作是否已創建,並直接添加到毫無條件的msi InstallExecuteSequence表中,直到我檢查了表。 我採納了您的建議,並將ConfigureUsers自定義操作條目添加到了InstallExecuteSequence標記中,並重新構建了msi。 msi InstallExecuteSequence表中的現有行已更新爲包含條件。 – 2010-06-21 15:13:36