Hi
I have a net7.0 class library which includes the following packages
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="ServerSampleData.fs" />
<Compile Include="MsSql\EntityMapper.fs" />
<Compile Include="MsSql\DataService.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
<PackageReference Include="mongocsharpdriver" Version="2.19.1" />
<PackageReference Include="MongoDB.Driver" Version="2.19.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="SQLProvider" Version="1.3.8" />
</ItemGroup>
</Project>
The entitymapper.cs has the following module
module DataModel =
let [<Literal>] dbVendor = Common.DatabaseProviderTypes.MSSQLSERVER
let [<Literal>] connString = ".."
let [<Literal>] useOptTypes = NullableColumnType.OPTION
let [<Literal>] contextSchemaPath = @"c:\temp\theschema.schema"
type sql = SqlDataProvider<dbVendor, connString, UseOptionTypes = useOptTypes, ContextSchemaPath=contextSchemaPath>
the dataprovider.fs is getting the context like that.
let context = sql.GetDataContext(storage.ConnectionString)
This is working ONLY working when I build it with Visual Studio, using “dotnet build” or Jetbrains Rider on my windows 10 machine or building via the azure pipelines with a Microsoft hosted agent it fails. I am using this pool in the pipeline.
pool:
vmImage: “windows-latest”
There I get the error
##[error]EntityMapper.fs(15,16): Error FS3033: The type provider ‘FSharp.Data.Sql.SqlTypeProvider’ reported an error: Microsoft.Data.SqlClient is not supported on this platform.
Anyone has an idea what I am missing here?