我有一个wix安装程序,它将sqlclr安装到数据库中。我使用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=""[SQLBINDIR]sqlcmd.exe" -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i "[#Install.sql]" -v PROGRAMDIR="[APPLICATIONFOLDER]"" />
<!--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=""[SQLBINDIR]sqlcmd.exe" -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i "[#Uninstall.sql]"" />
答案 0 :(得分:0)
这是任何有兴趣的人的修复。
似乎我的卸载遇到了鸡肉或鸡蛋问题。 我的uninstall.sql文件在执行sqlcmd之前被删除了。 所以我在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=""[SQLBINDIR]sqlcmd.exe" -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i "[#Install.sql]" -v PROGRAMDIR="[PROGRAMDIR]"" />
<!--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=""[SQLBINDIR]sqlcmd.exe" -S [SQLSERVER] -d [SQLDATABASE] -U [SQLUSER] -P [SQLPASSWORD] -i "[#Uninstall.sql]"" />
<!--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" />