我有一个MSI安装程序属性SQLSERVER_AUTHENTICATIONMODE
,它在安装程序UI中设置(使用Wix对话框)。我在Wix项目中有一个XSLT,用于转换安装中包含的File.xml
。转换的类型取决于SQLSERVER_AUTHENTICATIONMODE
的值,例如:
<xsl:variable name="sqlServerAuthenticationMode">[SQLSERVER_AUTHENTICATIONMODE]</xsl:variable>
<xsl:choose>
<xsl:when test="$sqlServerAuthenticationMode = 1">
<util:XmlFile
Id="UpdateConnectionString"
Action="bulkSetValue"
ElementPath="//ConnectionString"
File="[INSTALLFOLDER]\File.xml"
Value="Provider=SQLOLEDB;Server=[SQLSERVER_SERVERNAME];database=[SQLSERVER_DATABASENAME];Integrated Security=SSPI;Persist Security Info=False;"/>
</xsl:when>
<xsl:otherwise>
<util:XmlFile
Id="UpdateConnectionString"
Action="bulkSetValue"
ElementPath="//ConnectionString"
File="[INSTALLFOLDER]\File.xml"
Value="Provider=SQLOLEDB;Server=[SQLSERVER_SERVERNAME];database=[SQLSERVER_DATABASENAME];User Id=[SQLSERVER_USERNAME];Password=[SQLSERVER_PASSWORD];Persist Security Info=False;"/>
</xsl:otherwise>
</xsl:choose>
xsl:variable
未正确设置,因为$sqlServerAuthenticationMode = 1
永远不会成立。例如,当SQLSERVER_AUTHENTICATIONMODE
为1时,$sqlServerAuthenticationMode
应设置为1,但不是。