fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
580 stars 146 forks source link

SQLProvider + PostgreSql works with Rider and VSCode but not visual studio 2022 #792

Open kgday opened 1 year ago

kgday commented 1 year ago

Describe the bug SqlProvider + postgresql with Rider but not Visual Studio 2022

Set up the provider as per usual using rider

    [<Literal>]
    let private designTimeDataConnStr = @"Server=127.0.0.1;Database=WGDDev;Username=WGDApp;Password=<password>"

    [<Literal>]
    let private resolutionPath = __SOURCE_DIRECTORY__ + @"\DBLib"

    type Sql = SqlDataProvider<
        ConnectionString = designTimeDataConnStr,
        DatabaseVendor = DatabaseProviderTypes.POSTGRESQL,
        ResolutionPath = resolutionPath,
        UseOptionTypes = NullableColumnType.OPTION

The picture below shows the files in the DBLib directory:

image

Expected behavior For SqlProvider to work equally as well in Visual Studio as in Rider

Desktop (please complete the following information):

The error message in Visual Studio is

The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Details: 
Could not load type 'System.IAsyncDisposable' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Threading.Tasks.Sources.IValueTaskSource`1' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Collections.Generic.IAsyncEnumerable`1' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Collections.Generic.IAsyncEnumerator`1' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.ReadOnlyMemory`1' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Runtime.CompilerServices.ValueTaskAwaiter`1' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Runtime.CompilerServices.ValueTaskAwaiter' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Could not load type 'System.Memory`1' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Current execution platform: .NETFramework,Version=v4.7.2    WGD.DB  D:\Development\Projects\Upwork\WGD\Src\WGD.DB\DataConnection.fs 28  Active