FAKE icon indicating copy to clipboard operation
FAKE copied to clipboard

invalid parameter 'net60' after >= or < in '== net50' while upgrading netcoreapp3.1 to net5.0

Open imranypatel opened this issue 3 years ago • 22 comments

Description

Error while targetting net5.0 framework.

Repro steps

  1. dotnet new -i Saturn.Template
  2. md saturn2net5
  3. dotnet new saturn -lang F#
  4. Change TFM in saturn2net5.fsproj TargetFramework as: net5.0
  5. Change TFM in paket.dependencies as: framework: net5.0
  6. dotnet new tool-manifest --force
  7. dotnet tool install paket
  8. dotnet tool install fake-cli
  9. dotnet tool install saturn.cli
  10. dotnet paket update
  11. dotnet fake build -t run

Expected behavior

Build and run project successfully on net5.0

Actual behavior

Producing error:

There was a problem while setting up the environment: -> Error during parsing of 'D:\Work\iprnd\fs\ipstackNG21\saturn2net5\paket.lock'. -> invalid parameter 'net50' after >= or < in '== net50' Hint: If you just upgraded the fake-runner you can try to remove the .fake directory and try again.

Known workarounds

Still searching...

Related information

  • Operating system Windows 10
  • Version of .Net Core

.NET SDK (reflecting any global.json): Version: 5.0.101 Commit: d05174dc5a

Runtime Environment: OS Name: Windows OS Version: 10.0.19041 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.101\

  • Version of Paket (5.257.0)
  • Version of FAKE-CLI (5.20.3)
  • Version of SATURN.CLI (0.12.1)
  • Version of F#

D:\Work\iprnd\fs\ipstackNG21\saturn2net5>dotnet fsi Microsoft (R) F# Interactive version 11.0.0.0 for F# 5.0

imranypatel avatar Jan 16 '21 19:01 imranypatel

Welcome to the FAKE community! Thank you so much for creating your first issue and therefore improving the project!

github-actions[bot] avatar Jan 16 '21 19:01 github-actions[bot]

I think this is the same issue as I have.

halcwb avatar Feb 14 '21 20:02 halcwb

Using the pre-release 5.20.4-alpha.1642 works for me for now.

seanamosw avatar Feb 15 '21 17:02 seanamosw

Unfortunately not for me. And it's a pity that none of the maintainers are responding to these issues.

halcwb avatar Feb 16 '21 08:02 halcwb

@halcwb Sorry, I kind of lost motivation for various reasons. Nobody volunteered yet to take over. And to be honest some people prefer the "the build as a project && dotnet run" approach which doesn't have issues like these and might be a way out of this as I guess you are not volunteering to take over.

matthid avatar Feb 16 '21 16:02 matthid

@matthid. I am sorry to hear this. I do sympathise with your predicament. This is something that happens more often in other really wonderful F# open source projects. It's the burden of maintenance. Unfortunately, I am not really qualified to help you, I am a full time pediatric intensive care doctor who can only work on software projects in spare time.

Doesn't Microsoft or other companies invest any resources to help you? It would be a shame if Fake would just wither away like this.

P.S. I did try to upgrade to the latest Paket in a cloned Fake. But got the same error message, maybe because the bootstrapping of FAKE used the old FAKE version?

P.P.S. Isn't this pull request the solution? https://github.com/fsharp/FAKE/pull/2556.

halcwb avatar Feb 17 '21 17:02 halcwb

I get this error without targeting .net50 Paket version 5.257.0 My paket.dependencies says frameworks: net461, netcoreapp3.1, netstandard2.0 ...but Paket has itself put net50 to paket.lock in some reference components.

Thorium avatar Mar 03 '21 09:03 Thorium

@halcwb Sorry, I kind of lost motivation for various reasons. Nobody volunteered yet to take over. And to be honest some people prefer the "the build as a project && dotnet run" approach which doesn't have issues like these and might be a way out of this as I guess you are not volunteering to take over.

@matthid I have 'upgraded' your issue to the F# forum. Hope you agree, but I think this is quite relevant in general.

halcwb avatar Mar 04 '21 09:03 halcwb

If I manually replace from paket.lock

  • (< net50)
  • - restriction: >= net50
  • (>= net50)

...with empty string, then I'm able to run the build.

Thorium avatar Mar 05 '21 18:03 Thorium

There has not been any activity in this issue for the last 3 months so it will be closed in 14 days if there is no activity.

github-actions[bot] avatar Jun 04 '21 00:06 github-actions[bot]

How is non-merged PR-fix not any action?

Thorium avatar Jun 04 '21 08:06 Thorium

This issue has not been resolved and should be reopened.

ScottShingler avatar Jun 30 '21 16:06 ScottShingler

@yazeedobaid Note there are many issues which were automatically closed by the auto-closing agent bot which was set up in this repo (I don't know why...)

dsyme avatar Nov 06 '21 23:11 dsyme

@yazeedobaid Note there are many issues which were automatically closed by the auto-closing agent bot which was set up in this repo (I don't know why...)

@dsyme Thanks for the note. I have disabled the stable bot in the .NET 6 support PR, in this commit Thanks

yazeedobaid avatar Nov 07 '21 19:11 yazeedobaid

I encountered this as well today, here's a twitter convo with @forki indicating Paket supports it but the Paket in FAKE is probably outdated: https://twitter.com/sforkmann/status/1458104833723060226

CumpsD avatar Nov 09 '21 21:11 CumpsD

We do need an update to FAKE fairly soon that either takes out the Paket support, or makes it optional (is there a way to do this?), or brings it up-to-date. FAKE is currently unusable as soon as Paket is used with anything net60.

dsyme avatar Nov 09 '21 22:11 dsyme

What about pushing this to nuget? https://github.com/fsprojects/FAKE/blob/release/next/RELEASE_NOTES.md#5205-alpha---2021-11-07

CumpsD avatar Nov 09 '21 22:11 CumpsD

Yes I think we should be pushing it to nuget ASAP - even if it's marked pre-release. @yazeedobaid is looking at the release pipeline I think

dsyme avatar Nov 09 '21 22:11 dsyme

We do need an update to FAKE fairly soon that either takes out the Paket support, or makes it optional (is there a way to do this?), or brings it up-to-date. FAKE is currently unusable as soon as Paket is used with anything net60.

I guess it was introduced to be able to reference NuGet packages in the build.fsx files, but now that this has native support, maybe FAKE cli doesn't have to rely on Paket anymore? You won't get the lock file for the script file anymore though, but maybe that's Ok.

atlemann avatar Dec 02 '21 13:12 atlemann

Replacing

#I __SOURCE_DIRECTORY__

#r "paket: groupref Build //"

#load @".fake/build.fsx/intellisense.fsx"

#if !FAKE
  #r "netstandard"
#endif

with the following

#r "nuget:Fake.Core.Process"
#r "nuget:Fake.Core.Environment"
#r "nuget:Fake.Core.SemVer"
#r "nuget:Fake.Core.Target"
#r "nuget:Fake.DotNet.Cli"
#r "nuget:Fake.DotNet.MSBuild"
#r "nuget:System.Reactive"
#r "nuget:MSBuild.StructuredLogger,2.1.507" // Workaround for issue https://github.com/fsprojects/FAKE/issues/2595

let execContext = Fake.Core.Context.FakeExecutionContext.Create true "" []
Fake.Core.Context.setExecutionContext (Fake.Core.Context.RuntimeContext.Fake execContext)

and running with

dotnet fsi build.fsx

might be a workaround. Just have to figure out how to pass any target arguments into the script.

atlemann avatar Dec 08 '21 10:12 atlemann

if https://github.com/fsharp/fslang-suggestions/issues/1144 were implemented using fsi might be a viable solution rather than just a workaround. If you need args for your fsx you can use https://stackoverflow.com/questions/27342987/run-f-script-with-parameters/55719236#55719236

voronoipotato avatar Jun 16 '22 19:06 voronoipotato

This will probably hit after every new .NET major version release. I almost miss the FSharpTargetsPath. :-D

Thorium avatar Nov 15 '23 20:11 Thorium