.NET Standard 2.0 TPDTC with external dependencies example
See original GitHub issueI wanted to make https://github.com/demetrixbio/FSharp.Data.Npgsql true .NET Standard 2.0 TPDTC such that consuming projects can be compiled only with .NET Core SDK tools.
I followed https://github.com/fsprojects/FSharp.TypeProviders.SDK#making-a-net-standard-20-tpdtc and https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1003-loading-type-provider-design-time-components.md but I get an error
error FS3033: The type provider 'FSharp.Data.Npgsql.NpgsqlProviders' reported an error: Could not load file or assembly 'Npgsql, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'. The system cannot find the file specified.
So unless workaround applied consuming projects fail to compile.
After followed @dsyme suggestion https://twitter.com/mitekm/status/1024451317526233089
It helped with to solve TPDTC dependency loading issue but I got stuck with following error
error FS1108: The type 'Void' is required here and is unavailable. You must add a reference to assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
It’s not a first time I hit TPDTC dependency management issue while working on type provider that targets .NET Core runtime. It would be helpful either to extend BasicProvider.DesignTime project to demo how to handle external dependencies or create separate sample type provider to cover that case.
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (15 by maintainers)
Top GitHub Comments
There is the same problem with the latest released version as well, v2.2.203.
My workaround is to replace
with
where fscfix.bat is
That is it ignores the first argument and calls fsc.exe (which I have in my path) with the file that is going to be compiled.
However this fix isn’t needed when building in visual studio 2019.
Edit:
This batch file works both with dotnet build and from visual studio:
@larjo Thanks very much for posting your workaround, this was what eventually got it working for me (SqlProvider with MsSql).
I naively thought Type Providers might save me time, instead I spend my life just trying to get them working hehe.