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

"Getting started" steps fail with "FS0810: Property 'CultureName' cannot be set" #353

Closed cmeeren closed 3 years ago

cmeeren commented 3 years ago

Description

When following the "Getting started" steps in the readme, the dotnet build step fails.

Repro steps

dotnet new -i FSharp.TypeProviders.Templates
dotnet new typeprovider -n LemonadeProvider -lang F#
cd LemonadeProvider
dotnet tool restore
dotnet paket update
dotnet build -c release

Expected behavior

The build succeeds.

Actual behavior

The build fails with the following errors:

D:\Source\Repos\LemonadeProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs(2090,13): error FS0810: Property 'CultureName' cannot be set [D:\Source\Repos\LemonadeProvider\src\LemonadeProvider.DesignTime\LemonadeProvider.DesignTime.fsproj]
D:\Source\Repos\LemonadeProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs(3162,13): error FS0810: Property 'CultureName' cannot be set [D:\Source\Repos\LemonadeProvider\src\LemonadeProvider.DesignTime\LemonadeProvider.DesignTime.fsproj]

Known workarounds

Change minimum target to net461. Replace all instances of net45 with net461, except for in netfx.props, where you can just delete the lines referencing net45* frameworks (I suspect the removal of those lines isn't strictly speaking necessary).

cmeeren commented 3 years ago

To be specific, the following lines are invalid on net45 because AssemblyName.CultureName is not settable on net45:

https://github.com/fsprojects/FSharp.TypeProviders.SDK/blob/1584152b527903e267f8f6f661c3c6f07659819e/src/ProvidedTypes.fs#L2090

https://github.com/fsprojects/FSharp.TypeProviders.SDK/blob/1584152b527903e267f8f6f661c3c6f07659819e/src/ProvidedTypes.fs#L3162

cmeeren commented 3 years ago

I was able to work around the issue by targeting net461 instead of net45. I simply replaced all instances of net45 with net461, except for in netfx.props, where I just deleted the lines referencing net45* frameworks.

cmeeren commented 3 years ago

I see that #339 was merged some weeks ago, so I tried with the contents of this folder on master and it works fine. I suggest the dotnet new template is updated. I'll leave this for you to close.

JordanMarr commented 3 years ago

I see that #339 was merged some weeks ago, so I tried with the contents of this folder on master and it works fine. I suggest the dotnet new template is updated. I'll leave this for you to close.

I’m having the same issue. So you are saying that this issue has been fixed but the template hasn’t been updated yet?

cmeeren commented 3 years ago

Correct.

borseno commented 3 years ago

I removed the 45s from netfx and changed net45 to 461 in project files, (just as in the instruction above) but it now gives me this error:

C:\Users\user\source\repos\HelloWorldProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs(55,9): error FS0074: The type referenced through 'System.String' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard'. [C:\Users\user\source\repos\HelloWorldProvider\src\HelloWorldProvider.DesignTime\HelloWorldProvider.DesignTime.fsproj]

dsyme commented 3 years ago

This is fixed now in master