Skip to content

Could not load assembly Microsoft.Data.SqlClient #834

Open
@halcwb

Description

@halcwb

Describe the bug
When using code with a datacontext in an fsx file, sometimes this works. Sometimes I get the runtime error:

error FS0193: Could not load file or assembly 'C:\Users\bhr-cbollen.nuget\packages\microsoft.data
.sqlclient\5.2.2\runtimes\win\lib\net8.0\Microsoft.Data.SqlClient.dll'. The located assembly's man
ifest definition does not match the assembly reference. (0x80131040)

My current setup looks like:

#r "nuget: Microsoft.Data.SqlClient"
#r "nuget: SqlProvider"

#r "../../Informedica.Utils.Lib/bin/Debug/net9.0/Informedica.Utils.Lib.dll"
#r "../../Informedica.MetaVision.Lib/bin/Debug/net9.0/Informedica.MetaVision.Lib.dll"

#load "../../Shared/Utils.fs"
#load "../../Shared/Query.fs"
#load "../DataContext.fs"
#load "../ForeignKeys.fs"
#load "../Context.fs"
#load "../Parameter.fs"
#load "../Signals.fs"

#time

open System

fsi.AddPrinter(_.ToString("dd-MM-yyyy HH:mm"))

open Informedica.DataServices.Lib
open Informedica.MV6.Lib
open Informedica.MetaVision.Lib
open Informedica.Utils.Lib
open Informedica.Utils.Lib.BCL

open FSharp.Data.Sql.Operators

let ctx =
Context.create connstring

The error occurs at runtime.

To Reproduce
Steps to reproduce the behavior:
I wish I would know how. Probably, then I even could fix it.

Expected behavior
Be able to use SqlProvider in an script setting

Screenshots

Desktop (please complete the following information):
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.7+5b8665660

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100\

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4

.NET SDKs installed:
6.0.300 [C:\Program Files\dotnet\sdk]
6.0.321 [C:\Program Files\dotnet\sdk]
6.0.427 [C:\Program Files\dotnet\sdk]
7.0.102 [C:\Program Files\dotnet\sdk]
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.100 [C:\Program Files\dotnet\sdk]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions