我有一个带有许多设置和连接字符串的 C# 控制台应用程序。我的目标是为每个环境(QA、UAT、PROD 等)设置不同的连接字符串值和应用程序设置。我知道最好的方法是添加配置转换文件。当我只用一行转换将 App.QA.config 文件添加到我的应用程序时
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyDB"
connectionString="QASQLServer"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
</configuration>
由于错误,我无法再构建:
XXX.ServiceFramework.dll 中出现“System.IO.FileLoadException”类型的未处理异常附加信息:无法加载文件或程序集“Common.Logging.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e”或它的依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常:0x80131040)
当我删除 App.QA.config - 我仍然可以构建和运行我的应用程序