调试时查看连接字符串时,值为“abc”;不是我将 Windows 环境变量设置为的值。
网络配置
<configSections>
<section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
</configSections>
<configBuilders>
<builders>
<add name="Environment" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</builders>
</configBuilders>
<connectionStrings configBuilders="Environment">
<add name="myConnection" connectionString="abc" providerName="System.Data.SqlClient"/
</connectionStrings>
我已经仔细检查了是否安装了正确的 Nuget 包,框架在 4.7.2 上是否正确,我的拼写是否正确,并且我已经多次阅读了有关Configuration Builders的 Microsoft 文档。