fsprojects/SQLProvider

Microsoft.Data.SqlClient with SSDT?

NickDarvey opened this issue ยท 5 comments

Description

I'm wanting to use Microsoft.Data.SqlClient with the SSDT Provider. The documentation say I need to use MSSQLSERVER_DYNAMIC, but is it possible with MSSQLSERVER_SSDT?

I've read the instructions in #645 and included the appropriate assemblies in a folder and set it as the resolutionPath. However, it fails trying to load System.Data.SqlClient.

Repro steps

[<Literal>]
let private Schema = __SOURCE_DIRECTORY__ + @"/../DatabaseProject/bin/Debug/DatabaseProject.dacpac"

type Schema = 
  SqlDataProvider<
    Common.DatabaseProviderTypes.MSSQLSERVER_SSDT, 
    SsdtPath = Schema,
    UseOptionTypes = true
  >

let create (connectionString: string) =
  Schema.GetDataContext(connectionString, resolutionPath = @"C:\testing\runtimes")

Expected behaviour

Please provide a description of the behaviour you expect.

Actual behaviour

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.SqlClient, Version=4.6.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.'

Known workarounds

None.

Related information

  • Operating system
    • windows [19043.1288]
    • macOs [insert version]
    • linux [insert flavor/version here]
  • Platform
    • dotnet core [5.0.104]
    • dotnet full
    • mono
  • Branch or release version [1.2.10]

I'm currently facing the exact same issue. @NickDarvey did you find a solution for this?

The MSSQLSERVER_SSDT provider is hardwired to use System.Data.SqlClient. I'm pretty sure the resolutionPath is designed to work in conjunction with the MSSQLSERVER_DYNAMIC provider only.

AFAIK, the only way to use Microsoft.Data.SqlClient with MSSQLSERVER_SSDT would be to change the provider (or create a new one).

@NickDarvey did you find a solution for this?

I didn't, sorry @ratsclub

@JordanMarr I would rather create a new one than change MSSQLSERVER_SSDT or has some kind of parameter to combine these... Microsoft.Data.SqlClient brings a huge dependency network #724 (comment), and if you look inside of it, mostly what it does is forwarding types to the old System.Data.SqlClient.

The version 1.3.5 is now using Microsoft.Data.SqlClient on .Net6.0 and .NetStandard 2.1,
and the old System.Data.SqlClient on .Net 4.7.2 and .NetStandard 2.0.
This is initial trial via simple conditional compilation (because the base classes are the same) so please let me know if it works or not.