fsprojects / FAKE

FAKE - F# Make
https://fake.build
Other
1.28k stars 586 forks source link

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

Open imranypatel opened 3 years ago

imranypatel commented 3 years ago

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

github-actions[bot] commented 3 years ago

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

halcwb commented 3 years ago

I think this is the same issue as I have.

seanamosw commented 3 years ago

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

halcwb commented 3 years ago

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

matthid commented 3 years ago

@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.

halcwb commented 3 years ago

@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.

Thorium commented 3 years ago

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.

halcwb commented 3 years ago

@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.

Thorium commented 3 years ago

If I manually replace from paket.lock

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

github-actions[bot] commented 3 years ago

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.

Thorium commented 3 years ago

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

ScottShingler commented 3 years ago

This issue has not been resolved and should be reopened.

dsyme commented 2 years ago

@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...)

yazeedobaid commented 2 years ago

@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

CumpsD commented 2 years ago

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

dsyme commented 2 years ago

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.

CumpsD commented 2 years ago

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

dsyme commented 2 years ago

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

atlemann commented 2 years ago

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 commented 2 years ago

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.

voronoipotato commented 2 years ago

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

Thorium commented 11 months ago

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

Thorium commented 2 months ago

Paket dependency has been updated, helps this. For future issues: Paket dependency has to be kept up-to-date.