fsprojects / FSharp.Configuration

The FSharp.Configuration project contains type providers for the configuration of .NET projects.
http://fsprojects.github.io/FSharp.Configuration/
Other
114 stars 63 forks source link

Typeprovider constructor error when built using dotnet from command prompt #154

Open priv22 opened 4 years ago

priv22 commented 4 years ago

The type provider 'FSharp.Configuration.ConfigTypeProvider+FSharpConfigurationProvider' reported an error : The type provider constructor has thrown an exception: System.Runtime.Caching is not supported on this platform.

I am figuring out F#... I can build it and run it without errors in Visual Studio. But when I try to build it from the command prompt using dotnet build, I get the above error.

Advise please

Shmew commented 4 years ago

It doesn't look like this is maintained any longer. It's not currently targeting dotnet core, so it will only work with framework applications.

sergey-tihon commented 4 years ago

What version of TP and run do you use ? FSharp.Configuration 2.0.0-alpha2 should work on .NET Core

eacasanovaspedre commented 4 years ago

It's still failing on MacOs. I managed to use FSharp.Configuration on Windows using 2.0.0-alpha2 and the workaround for Type Providers with the file fsc.props. But still it won't compile on MacOs. When I add the file fsc.props the error I get is: FSC : error FS0226: The file extension of '/usr/local/share/dotnet/sdk/3.1.100/FSharp/fsc.exe' is not recognized. Source files must have extension .fs, .fsi, .fsx, .fsscript, .ml or .mli.

rbauduin commented 4 years ago

On Linux, using dotnet code 3.1, ionide reports this error:

The type provider 'FSharp.Configuration.ConfigTypeProvider+FSharpConfigurationProvider' reported an error: The type provider constructor has thrown an exception: System.Runtime.Caching is not supported on this platform.F# Compiler(3053)
Referenced assembly '/home/rb/.nuget/packages/fsharp.configuration/2.0.0-alpha2/lib/netstandard2.0/FSharp.Configuration.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were foundF# Compiler(3005)

I can compile it without error from the command line, but I'm not sure which is the correct behaviour.

drk-mtr commented 4 years ago

This doesn't happen when using Visual Studio 2019. It only occurs when using vscode or neovim with Ionide. I couldn't try the (non-Ionide) F# Language Server in vscode since that appears to be broken. And I don't have Rider (unfortunately!).

I have the same issue on MacOS, Windows and Linux using version 2.0.0-alpha2 and dotnet 3.1.102 (also 2.1.300). This is when referencing the package, it doesn't need an open statement to raise the error.

I imagine this is why it works for Sergey but not for others...

I wonder whether we should we be raising this in the FSAC or Ionide repos instead?

Just repeating the error messages here without scrollbars for legibility:

The type provider 'FSharp.Configuration.ConfigTypeProvider+FSharpConfigurationProvider' reported an error: The type provider constructor has thrown an exception: System.Runtime.Caching is not supported on this platform. F# Compiler(3053)

Referenced assembly 'C:\Users\usrname\.nuget\packages\fsharp.configuration\2.0.0-alpha2\lib\netstandard2.0\FSharp.Configuration.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found. F# Compiler(3005)

baronfel commented 4 years ago

There's an issue in ionide that I've referenced in https://github.com/fsharp/FsAutoComplete/issues/565, that I believe is related. It's on my radar, trying to see when I'll have time to investigate.

drk-mtr commented 4 years ago

Ah good to hear - thanks!