首页 > 解决方案 > F# 类型提供程序 FSharp,Data.SqlClient 目标 .NetStandard 2.0 在使用命令行中的 dotNet 构建时失败,但在 Visual Studion 2019 中成功

问题描述

我在针对 .Net-Standard-2.0 的 DLL 中使用 F# 类型提供程序 FSharp.Data.SqlClient,虽然这在 Visual Studio 2019 中成功构建,但当我尝试使用命令提示符编译器 dotNet 编译器构建它时失败,并出现以下错误信息

J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\BillOfDocuments\BillOfDocumentsDataAccess.fs(14,27): error FS3033: The type provider 'FSharp.Data.SqlProgrammabilityProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (0x80131058) [J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\EngWeb.Core.fsproj]
J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\BillOfDocuments\BillOfDocumentsDataAccess.fs(14,27): error FS3033: The type provider 'FSharp.Data.SqlProgrammabilityProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (0x80131058)

我正在使用 FSharp.Data.SqlClient 版本 2.0.6 和 System.Data.SqlClient 版本 4.8.1 和 FSharp.Core 版本 4.7.0

对此问题的任何帮助将不胜感激

标签: f#.net-standard-2.0fsharp.data.sqlclient

解决方案


推荐阅读