【问题标题】:ERROR:System.Data.SqlClient is not supported on this platform错误:此平台不支持 System.Data.SqlClient
【发布时间】:2021-01-05 20:09:10
【问题描述】:
一般来说,出于某种原因,当您将 Publish 作为独立的 Win x64 应用程序运行时,
此平台不支持Sql客户端错误
,虽然如果你在VS下运行它,一切都很好。
.Net Core 是 2.2 版,带有用于 Sql Server 的最新可用 lib 版本。
可能是什么问题?
起初,我试图在启动时执行迁移是有罪的。 cs,但是在剪掉它之后,我在尝试减去数据时开始遇到同样的错误。
【问题讨论】:
标签:
sql-server
entity-framework
.net-core
asp.net-core-mvc
【解决方案1】:
只需编辑项目文件,问题就解决了:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier> --Add new platform
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
<UserSecretsId>ed6862ca-e455-4714-9552-bff6407b2370</UserSecretsId> </PropertyGroup>