Wix中的连接字符串更新

时间:2016-11-21 06:16:33

标签: wix

在使用Wix进行WCF服务创建安装程序包期间,我遇到了一个问题。我的应用程序有一个wcf表单和服务。我已将该服务添加为该表单应用程序的服务引用。应用程序安装正常。但是连接字符串没有得到更新。请帮我解决错误。代码如下:

 <DirectoryRef Id="Directoryconn">
  <!-- Component handling the web.config -->
  <Component Id="ConnectionSqlAuth" Guid="{7B545D7D-FC59-4CAE-9ADC-DC473690B520}">
    <File Id="fil62C70949D477305C96D703343FBCFD58" KeyPath="yes" Source="$(var.ServiceLibrary_TargetDir)ServiceLibrary.dll.config" />
    <util:XmlFile Id="SetDatabaseConnectionSql" Action="setValue" ElementPath="/configuration/connectionStrings/add[\[]@name='DbConnection'[\]]/@connectionString" Value="Data Source=[DB_SERVER];Initial Catalog=[DB_DATABASE];User ID=[DB_USER];Password=[DB_PASSWORD];" File="[INSTALLFOLDER]ServiceLibrary.dll.config" SelectionLanguage="XPath" Sequence="1" />
    <wix:Condition xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">DB_AUTHENTICATION ="SQL Server Authentication"</wix:Condition>
  </Component>

  <!-- Component handling the App.config -->
  <Component Id="ConnectionWindowsAuth" Guid="{5816f7d8-eaa6-4193-a29a-9135e9036007}">
    <File Id="fil62C70949D477305C96D703343FBCFD59" KeyPath="yes" Source="$(var.ServiceLibrary_TargetDir)ServiceLibrary.dll.config" />
    <util:XmlFile Id="SetDatabaseConnectionWindow" Action="setValue" ElementPath="/configuration/connectionStrings/add[\[]@name='DbConnection'[\]]/@connectionString" Value="Data Source=[DB_SERVER];Initial Catalog=[DB_DATABASE];Integrated Security=True;" File="[INSTALLFOLDER]ServiceLibrary.dll.config" SelectionLanguage="XPath" Sequence="1" />
    <wix:Condition xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">DB_AUTHENTICATION ="Windows Authentication"</wix:Condition>
  </Component>
</DirectoryRef>

0 个答案:

没有答案