2016-08-17 3 views
-1

데이터베이스에 sqlclr을 설치하는 wix 설치 프로그램이 있습니다. 스크립트를 실행하기 위해 sqlcmd를 사용하고 있습니다.WIX가 제거 중에 sqlcmd를 실행합니다.

사용자가 응용 프로그램을 제거 할 때 sqlclr도 제거하고 싶습니다. 이것은 내가 지금까지 가지고 있고 작동하지 않는 것입니다.

<InstallExecuteSequence> 
    <Custom Action="sqlcmd.install" After="InstallFiles">NOT Installed</Custom> 
    <!--Ensure this runs after the CA to set up the property for its cmd line--> 
    <Custom Action="sqlcmd" After="sqlcmd.install">NOT Installed</Custom> 
    <Custom Action="NewerVersion" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom> 
    <RemoveExistingProducts After="InstallInitialize" /> 
    <Custom Action="sqlcmd.uninstall" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE</Custom> 
</InstallExecuteSequence> 
<!--Find sqlcmd.exe path--> 
<Property Id="SQLBINDIR"> 
    <RegistrySearch Id="SqlBinDir" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup" Name="Path" Type="raw" /> 
</Property> 
<!--Need to use "property" CA to get variable substitution--> 
<CustomAction Id="sqlcmd.install" Property="sqlcmd" Value="&quot;[SQLBINDIR]sqlcmd.exe&quot; -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i &quot;[#Install.sql]&quot; -v PROGRAMDIR=&quot;[APPLICATIONFOLDER]&quot;" /> 
<!--Note that the cmd line and args will come from a property with the same name as the CA, this has been set by the CA above--> 
<CustomAction Id="sqlcmd" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="check" Execute="deferred" Impersonate="yes" /> 
<CustomAction Id="sqlcmd.uninstall" Property="sqlcmd" Value="&quot;[SQLBINDIR]sqlcmd.exe&quot; -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i &quot;[#Uninstall.sql]&quot;" /> 

답변

0

여기에 관심있는 모든 사람들을위한 픽스입니다.

닭 제거 또는 달걀 문제가 발생했습니다. sqlcmd가 실행되기 전에 내 uninstall.sql 파일이 제거되었습니다. 그래서 RemoveFiles 전에 제거 프로그램을 변경했습니다.

<InstallExecuteSequence> 

    <Custom Action="installcmd.install" After="InstallFiles">NOT Installed</Custom> 
    <!--Ensure this runs after the CA to set up the property for its cmd line--> 
    <Custom Action="installcmd" After="installcmd.install">NOT Installed</Custom> 

    <Custom Action="uninstallcmd.uninstall" Before="RemoveFiles">Installed AND NOT REINSTALL</Custom> 
    <!--Ensure this runs after the CA to set up the property for its cmd line--> 
    <Custom Action="uninstallcmd" After="uninstallcmd.uninstall">Installed AND NOT REINSTALL</Custom> 

    <Custom Action="NewerVersion" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom> 
    <RemoveExistingProducts After="InstallInitialize"/> 

</InstallExecuteSequence> 



<!--Find sqlcmd.exe path--> 
<Property Id="SQLBINDIR"> 
    <RegistrySearch Id="SqlBinDir" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\130\Tools\ClientSetup" Name="Path" Type="raw" /> 
</Property> 

<!--Need to use "property" CA to get variable substitution--> 
<CustomAction Id="installcmd.install" Property="installcmd" Value="&quot;[SQLBINDIR]sqlcmd.exe&quot; -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i &quot;[#Install.sql]&quot; -v PROGRAMDIR=&quot;[PROGRAMDIR]&quot;" /> 
<!--Note that the cmd line and args will come from a property with the same name as the CA, this has been set by the CA above--> 
<CustomAction Id="installcmd" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="check" Execute="deferred" Impersonate="yes" /> 

<CustomAction Id="uninstallcmd.uninstall" Property="uninstallcmd" Value="&quot;[SQLBINDIR]sqlcmd.exe&quot; -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i &quot;[#Uninstall.sql]&quot;" /> 
<!--Note that the cmd line and args will come from a property with the same name as the CA, this has been set by the CA above--> 
<CustomAction Id="uninstallcmd" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="check" Execute="deferred" Impersonate="yes" /> 
관련 문제