fsprojects / FSharp.TypeProviders.SDK

The SDK for creating F# type providers
https://fsprojects.github.io/FSharp.TypeProviders.SDK/
MIT License
298 stars 94 forks source link

Creating a netstandard library with a netcoreapp design time assembly #360

Closed daniellittledev closed 3 years ago

daniellittledev commented 3 years ago

Description

I'm looking for information about creating a netstandard library with a netcoreapp design time assembly. I have type provider using System.Configuration.ConfigurationManager that I'm trying to update for dotnetcore. I initially used netstandard2.0 for both projects however when using the type provider there was an error loading ConfigurationManager because it was loading the reference assembly instead of the implementation assembly.

Then I changed the design time assembly to target netcoreapp2.2 but when loading the type provider it could not find the assembly. Note that the lib assembly was still netstandard2.0.

So I have two questions?

  1. Do the targets of the assemblies need to be the same?
  2. Can you target netcoreapp2.2 for type providers (I assume this then means you can't use it from a netstandard project)?
dsyme commented 3 years ago

You need to target netcoreapp3.0 or net5.0 and make sure your type provider bits are places into typeproviders/fsharp41/netcoreapp3.0 in your nuget package.

However such type providers won't be usable in tooling that runs .NET Framework (e.g. Visual Studio) so you should in general refrain from doing this unless you make a matching net472 target for your type provider.