我将翻译以下内容:
它应该看起来像这样:
部署任务如下所示:
我正在为CI&D配置我的应用程序。 我创建了一个名为DEV-Deploy的web.config转换,其中包含用于开发测试环境的连接字符串。
以下是Web.DEV-Deploy.config连接字符串部分的内容:
<connectionStrings xdt:Transform="RemoveAttributes(configSource)">
<add name="DbContext"
providerName="MySql.Data.MySqlClient"
connectionString="CXN_STRING"
xdt:Transform="Insert" xdt:Locator="Match(name)"/>
<add name="elmah"
connectionString="CXN_STRING"
xdt:Transform="Insert" xdt:Locator="Match(name)"/>
</connectionStrings>
它应该看起来像这样:
<connectionStrings>
<add name="DbContext" providerName="MySql.Data.MySqlClient"
connectionString="CXN_STRING"/>
<add name="elmah" connectionString="CXN_STRING"/>
</connectionStrings>
我正在使用命令行构建,已经尝试了以下两个命令,但都没有起作用:
msbuild web\web.csproj /T:Package /P:Configuration=DEV-Deploy /P:TransformConfigFiles=true
msbuild web\web.csproj /T:Package /P:Configuration=DEV-Deploy /t:TransformWebConfig
部署任务如下所示:
web.deploy.cmd /Y /M:https://MACHINEIP:8172/msdeploy.axd -allowUntrusted /U:USERNAME /P:PASSWORD /A:Basic
部署后,web.config 的内容如下:
<connectionStrings configSource="connectionStrings.config"></connectionStrings>
我已经尽力在我的本地机器上进行了测试,但无法复制这个问题。在构建过程中,我需要怎么做才能让变换正常工作?