dotnet / dotnet/fsharp

FSX file in Visual Studio attempts to load .NET 7 assemblies

Open
#15,604 0 comments 0 reactions 1 assignee Claimed by @KevinRansom View on GitHub
AI-thinks-windows-only Area-TypeProviders Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

Visual Studio cannot confuses NET FW and NET probably. When I have FSX opened in Ionide, then type provider works fine.

**Repro steps**

1. Create test.fsx with following content
```fsharp
#r "nuget: Npgsql"
#r "nuget: SQLProvider"
open FSharp.Data.Sql

let [] connectionString = "Host=localhost;Port=5432;Database=backend;Username=konaev;Password="

// create a type alias with the connection string and database vendor settings
type sql = SqlDataProvider
```
2. Open test.fsx in visual studio.

**Expected behavior**

I would like to have no errors in Visual Studio.

**Actual behavior**

![image](https://github.com/dotnet/fsharp/assets/4257079/95e7d4e9-0f46-4c36-a667-2a6244830c98)

```
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 file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.Data.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.Diagnostics.Tracing, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.Threading, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.ComponentModel.TypeConverter, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Current execution platform: .NETFramework,Version=v4.7.2
```

**Known workarounds**

Provide a description of any known workarounds.

**Related information**

Provide any related information (optional):

* Operating system
* .NET Runtime kind (.NET Core, .NET Framework, Mono)
* Editing Tools (e.g. Visual Studio Version, Visual Studio) Version 17.7.0 Preview 2.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.