Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion - infer resolution path for script scenario .fsx (MacOs) ? #764

Open
jkone27 opened this issue Jun 16, 2022 · 1 comment
Open

Comments

@jkone27
Copy link

jkone27 commented Jun 16, 2022

Describe the bug
Would be nice if resolution path would be inferred by .nuget directory of .fsx script automatically...
also seems #r "nuget: System.Data.SqlClient" is required else the type throws an exception...

To Reproduce
use provider from .fsx script and try reference ngpqslq.dll from current directory

#r "nuget: SQLProvider"
#r "nuget: System.Data.SqlClient"
#r "nuget: Npgsql"

open FSharp.Data.Sql
open System
open Npgsql

//docker run --name posttest -d -p 5432:5432 -e POSTGRES_PASSWORD=password postgres:alpine


let [<Literal>] dbVendor = 
    Common.DatabaseProviderTypes.POSTGRESQL

let [<Literal>] connString = 
    "Host=127.0.0.1;Database=postgres;Username=postgres;Password=password;Port=5432"

let [<Literal>] resPath = __SOURCE_DIRECTORY__

// add npgsql.dll locally
type sql = SqlDataProvider<DatabaseVendor=dbVendor, ConnectionString=connString, ResolutionPath=resPath>

Expected behavior
Would be nice not to need the resolution path when using the type provider from scripts using

#r "nuget : SQLProvider"

Desktop (please complete the following information):

  • Device: MAC
  • OS: MacOS
@jkone27 jkone27 changed the title MacOs has to pass resolutionPath for NPGSQL.dll Suggestion - infer resolution path for script scenario .fsx (MacOs) ? Jun 16, 2022
@Thorium
Copy link
Member

Thorium commented Nov 14, 2022

This is a great idea, but how do we know the path of that DLL? With '#r' the FSI loads the SQLProvider then from nuget cache, but SQLProvider loads Npgsql via reflection, so we'd need to know the path and thus e.g. which version we are loading.

It seems to me that FSI creates some kind of temporary project in some location %home%\.packagemanagement\nuget\Projects\(guid)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants