2016-09-10 3 views
0

WiX 3.10으로 설치 프로그램을 만들고 있습니다. 내 원래 작업은 대상 시스템에 Postgres 파일을 복사하고, 클러스터를 초기화하고, 서비스를 등록하고, 설치시 데이터베이스를 복원하고, 역방향 중지 서비스에서 시스템에서 제거하고 클러스터 데이터를 지우는 것입니다. 나는 두 개의 박쥐 파일을 썼고, 그들을 실행하기 위해 커스텀 액션을 추가했고, 여러 장소에서 묘사 된 것과 같은 몇몇 조건을 추가했다. CDATA, Installed, INSTALLED 및 기타 변형을 사용하거나 사용하지 않으려 고 시도했지만 항상 두 작업을 모두 실행합니다.설치 또는 제거시에만 사용자 지정 작업 실행

다음은 지금 실험중인 wix 파일입니다.

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Product Id="*" Name="Hatred_6" Language="1033" Version="1.0.0.0" Manufacturer="Satan" UpgradeCode="d9602b10-8428-4031-8c82-99288b21377f"> 
     <Package InstallerVersion="405" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/> 

     <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
     <MediaTemplate EmbedCab="yes" /> 

     <CustomAction Id="AAction" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" Return="check" 
         ExeCommand="cmd.exe /c &quot;a.bat&quot;">NOT Installed</CustomAction> 

     <CustomAction Id="BAction" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" Return="check" 
         ExeCommand="cmd.exe /c &quot;b.bat&quot;">Installed</CustomAction> 

     <InstallExecuteSequence> 
      <Custom Action="BAction" After="InstallFiles" /> 
      <Custom Action="AAction" After="InstallFiles" /> 
     </InstallExecuteSequence> 

     <Feature Id="ProductFeature" Title="Hatred_6" Level="1"> 
      <ComponentGroupRef Id="ProductComponents" /> 
     </Feature> 
    </Product> 

    <Fragment> 
     <Directory Id="TARGETDIR" Name="SourceDir"> 
      <Directory Id="ProgramFilesFolder"> 
       <Directory Id="INSTALLFOLDER" Name="Hatred_6" /> 
      </Directory> 
     </Directory> 
    </Fragment> 

    <Fragment> 
     <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
      <Component Id="CalcComponent" Guid="515C0606-FD73-4B5D-ACF4-481123092A3E"> 
       <File Id="CalcFile" KeyPath="yes" Source="calc.exe" /> 
      </Component> 
      <Component Id="AComponent" Guid="515e3aa0-e5a0-4cd1-aaa5-ebf25a679a24"> 
       <File Id="AFile" KeyPath="yes" Source="a.bat" /> 
      </Component> 
      <Component Id="BComponent" Guid="85f7627e-fc39-4f78-a870-221d2d08375d"> 
       <File Id="BFile" KeyPath="yes" Source="b.bat" /> 
      </Component> 
     </ComponentGroup> 
    </Fragment> 
</Wix> 

박쥐 파일은 실제로 실행하는 경우 그래서 내가 볼 수 b.txt DIR> a.txt이와 DIR>을 포함한다. 다소 실망 스럽습니다. 오해입니까?

+0

사용자 작업이 실행되는지 확인하기 위해'dir> a.txt'보다는 자세한 로그를 사용하는 것이 좋습니다. –

+0

어쨌든 부작용을 일으키기 위해서는 박쥐 파일이 모두 필요합니다. 작업의 조건을 평가하는 방법을 설명 할 수있는 자세한 로그에는 아무것도 찾을 수 없습니다. – Encarmine

답변

6

조건은 CustomAction이 아니라 Custom 요소 안에 있어야합니다. 또한 제거 중에는 InstallFiles 작업이 없습니다. 대신 파일 을 사용하십시오..

<CustomAction Id="AAction" Directory="INSTALLFOLDER" Execute="deferred" 
       Impersonate="no" Return="check" ExeCommand="cmd.exe /c &quot;a.bat&quot;" /> 
<CustomAction Id="BAction" Directory="INSTALLFOLDER" Execute="deferred" 
       Impersonate="no" Return="check" ExeCommand="cmd.exe /c &quot;b.bat&quot;" /> 

<InstallExecuteSequence> 
    <Custom Action="AAction" After="InstallFiles">NOT Installed</Custom> 
    <Custom Action="BAction" Before="RemoveFiles">Installed</Custom> 
</InstallExecuteSequence> 
+0

이러한 조건은 업그레이드 중에도 계속 실행됩니다. "설치됨"은 설치중인 {제품 GUID} 제품을 나타냅니다. 주요 업그레이드를 통해 제품 GUID는 다르지만 업그레이드 GUID가 일치하므로 업그레이드 대상 제품을 알 수 있습니다. 첫 번째 설치 및 완료된 설치 제거시 ** 동작 **을 ** 수행하기 위해 ** NOT UPGRADINGPRODUCTCODE AND REMOVE ~ = "ALL"'두 가지 조건을 'NOT WIX_UPGRADE_DETECTED AND NOT Installed'로 수정합니다. –

+0

@BrianSutherland, 맞아요.하지만 경험에 따르면 주요 업그레이드 중에는 서비스를 중지해야하므로 작성자의 의도에 따라 원래 조건이 더 좋습니다. –

+0

@SutarminAnton 내가 만든 오류는 다소 당혹 스럽습니다. 귀하의 제안이 도움이되었습니다. 정확한 조건에 관해서는 내가 필요로 - 다른 좋은 대답에 대한 cheatsheets이 같은 http://stackoverflow.com/questions/320921/how-to-add-a-wix-custom-action-that-happens-only- on-uninstall-via-msi – Encarmine

관련 문제