fsprojects / FAKE

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

Update to .NET 7 #2713

Closed OnurGumus closed 1 year ago

OnurGumus commented 1 year ago

Description

Title says all.

github-actions[bot] commented 1 year ago

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

yazeedobaid commented 1 year ago

Here you go .NET 7 support is added to the FAKE runner through the update to Paket in 6.0.0-alpha003 release

OnurGumus commented 1 year ago

@yazeedobaid , while it works against .NET 7, it still requires .NET 6 SDK to exist

https://github.com/fsprojects/FAKE/blob/ada1877316c83eebb6c3695dd8e234c906276a0d/src/app/Fake.Runtime/SdkAssemblyResolver.fs#L203

So I don't think this problem is fixed.

yazeedobaid commented 1 year ago

@OnurGumus we are not planning to support .NET 7 in the runner. Currently, it is using .NET 6 since it is the current LTS release. Before this, we supported .NET 6 and NETSTANDARD reference assemblies and we had a lot of issues that we needed to do a workaround to fix them, which led us to drop support for NETSTANDARD in FAKE v6.

If you would like to use .NET 7 reference assemblies for any reason, you can check the alternative ways to use FAKE beside runner in Different ways to run FAKE. An increasingly popular approach to using FAKE is to Run FAKE using a dedicated build project.

OnurGumus commented 1 year ago

I understand but, In either case, doesn't this necessitate both .NET 6 and .NET 7 SDK's to exist in CI/CD or build images? This doesn't sound ideal.

yazeedobaid commented 1 year ago

No, other approaches utilize .NET and FSI, so it will use the currently installed .NET SDK you have. The other two approaches use .NET and FSI to resolve the dependencies in the script file, instead of the FAKE runner. Which will parse the Paket section, determine the dependencies, and add the .NET SDK reference assemblies.

OnurGumus commented 1 year ago

Hello @yazeedobaid when I tried the last approach I end up with Unhandled exception. System.Exception: Cannot retrieve 'Fake.Core.Target.ArgResults' as we have no fake context Any ideas?

OnurGumus commented 1 year ago

Second way also won't work failing with /.fake/build.fsx/intellisense_lazy.fsx' doesn't exist and it doesn't/

yazeedobaid commented 1 year ago

@OnurGumus for the last approach, you need to create a FAKE execution context in the build script. Like this:

Context.FakeExecutionContext.Create false "build.fsx" []
|> Context.RuntimeContext.Fake
|> Context.setExecutionContext

You can check samples in the docs for that method. For example, in MiniScaffold, these lines

For the second way you also don't need the lazy file, it was for runner and that method doesn't use it, so u can remove that statement.

Thorium commented 1 month ago

Same still here: Could not find a suitable .NET 6 runtime version matching SDK version: 8.0.205

OnurGumus commented 1 month ago

@Thorium you can use the second way. That works fine by me. .fsx scripts won't work