我如何替换连接字符串元素

问题描述 投票:-1回答:1

我有一个问题,似乎无法使用XML Transform解决。我的web.config包含以下内容

<connectionStrings>
    <add name="SQLConnString" 
         connectionString="yada yada" 
         providerName="System.Data.SQLClient"/>
</connectionStrings>

我的QA服务器及以上的服务器具有此

<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
    <EncryptedData>
        <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
    </EncryptedData>
</connectionStrings>

我在DevOps中使用什么任务来实现这种转换,或者进行这种转换的最佳方法是什么?

jc

azure-devops web-config azure-pipelines-release-pipeline
1个回答
0
投票

不确定所提到的确切原因是什么,但是可以使用File transform task实现上述转换。我再次对其进行了测试,它对我而言非常好用。

steps:
- task: FileTransform@1
  displayName: 'File Transform: '
  inputs:
    folderPath: '$(System.DefaultWorkingDirectory)'
    enableXmlTransform: true
    xmlTransformationRules: '-transform **\*.Dev.config -xml **\*.config'
    fileType: xml
© www.soinside.com 2019 - 2024. All rights reserved.