-
Notifications
You must be signed in to change notification settings - Fork 94
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
.NET Standard 2.0 TPDTC with external dependencies example #244
Comments
@dsyme Any updates on how to solve
? |
@dmitry-a-morozov Apologies for the slow reply, going through TPSDK issues now. Do you have a work-in-progress branch that I could use to trial different solutions? thanks |
Hi @dsyme There is a sample console app
Don't forget to adjust connection string If you'll choose default local installation no changes to connection string are necessary. |
@dsyme The sample app uses system schema so no need to create additional database on top of default installation. |
I will lay my reputation on the line and claim postgres can be installed in ~ 5 mins post download. Just pick default options, ignore stack builder and make sure you remember the password you create for the postgres user, and then connection string is something like
|
I've find the cause of this:
It's a painful problem and will require a painful workaround. More later tonight |
Great effort @dsyme ! |
Yes, I'll do this. Could you point me to the code you added for Assembly resolve events? I'd like to make the TPSDK have some version of that built-in |
Long term fix for painful problem is here: dotnet/fsharp#5621 |
Short term painful hack fix for painful problem is here: #259 |
@dmitry-a-morozov Ah yes! I forgot we had the RegisterProbingFOlder stuff still in the TPSDK |
@dmitry-a-morozov Assuming #259 goes through ok this should deal with all outstanding issues blocking you I hope. |
This is now addressed, and the template recently added is setup for TPDTCs with dependencies |
I'm working on converting the SQLProvider to .NET Standard 2.0, so I'd like to get this right. Sorry for the wall of text. My current fork(s) are a set of ComboProvider-style projects, each of which is just one .NET Standard 2.0 library each, except they have NuGet dependencies (a common package for shared code, plus each database's driver packages). These dependencies are used both at design-time and at runtime. Right now, to use e.g. Npgsql as a dependency, I need to copy But this means that any type provider dependencies are hidden from NuGet. When a user builds a project that references SQLProvider, the So the only way to make it play alongside with NuGet (what if the user adds a more recent patch version of Npgsql?) is to declare Npgsql as a dependency and pin it to the exact version included in the package. And I need to do the same for other transitive dependencies, which can inconvenience the user if one of them is, let's say, JSON.NET. The alternative is to split each provider into runtime and design-time components only for the purpose of keeping design-time dependencies managed separatedly, even though they're the same as runtime dependencies. Is the above correct? If it is, is it on the roadmap to make "combo" type providers work with regular NuGet dependencies? |
I believe if there are dependencies then you should split. |
With the preview dotnet SDK for 3.0 the
Note that the path in the error message is that of the dotnet SDK, rather than the one specified in As a test, I renamed the |
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 I'm really confused - the Azure Storage TP relied on the compiler tools nuget package and promptly broke when I installed VS2019, but I have since tried removing the Tools nuget package completely and the package appears to suddenly now work out of the box. I have no idea why the dependency is no longer required. |
@isaacabraham Interesting. So now, your type provider compiles with dotnet build and no "fsc.props-workaround" is needed? SqlProvider e.g. still needs the external fsc to compile though. |
@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. |
thanks @larjo for the workaround Just to add for reference so someone might find it useful - my case is compiling project with FSharp.Data to net40 using .NET SDK 3.0 preview and I'm using the FSharp.Compiler.Tools NuGet instead of preinstalled F# SDK I had to modify the
(note I'm using Paket |
I 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
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
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.
The text was updated successfully, but these errors were encountered: