2015-09-29 104 views
0

由於主要升級會刪除現有產品,因此在發生自動卸載時不需要執行SQL腳本。Wix組件UPGRADINGPRODUCTCODE條件不起作用

問題是我有數據庫用戶名和密碼作爲命令行參數傳遞,所以當它執行升級並自動運行卸載時,它會嘗試執行SQL腳本,但是沒有數據庫用戶名或密碼,所以升級失敗。您可以在SQL Profiler中看到用戶名被設置爲''(空白)。

我的組件代碼如下:

<Component Id="SQL" Guid="AF267662-23A0-4b46-B490-C11465BE9858" KeyPath="yes" > 
<Condition>NOT UPGRADINGPRODUCTCODE AND NOT REMOVE="ALL"</Condition>    
<!--UNINSTALL--> 
<sql:SqlScript Id="Uninstall.SQLScript" ExecuteOnInstall="no" ExecuteOnUninstall="yes" BinaryKey="SQLScript.Uninstall" User="SQLUser" SqlDb="SqlDatabase" Sequence="1"/> 

<!--INSTALL--> 
<sql:SqlScript Id="SQLScript2" ExecuteOnInstall="yes" ExecuteOnUninstall="no" BinaryKey="SQLScript.Create.DBObjects" User="SQLUser" SqlDb="SqlDatabase" Sequence="3"/> 
</Component> 

回答