我正在为 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>
我已尽我所能在本地机器上进行了测试,但无法复制该问题。我需要做什么才能使转换在构建上正常工作?