-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not find a suitable .NET 6 runtime version matching SDK version: 7.0.100 #2719
Comments
The FAKE runner is locked to .NET 6 runtime assemblies. In FAKE v6. the support for NETSTANDRD 2.0 has been dropped in the runner and it only searches for a .NET 6 SDK references assemblies. If it cannot find any, then the runner will fail with this message. Supporting multiple reference assemblies causes problems before when we supported NETSTANDARD2.0 and NET 6, and we had to do some workarounds to overcome them - and some we could not, hence we dropped support for NETSTANDARD. Locking runner to .NET 6 and making it a requirement to use FAKE runner, and providing alternative options to run FAKE; use FSI directly or a dedicated build project (please see Different ways to run FAKE) was the option we went on with, especially since the approach to using a dedicated build project is being adopted recently. If we can support .NET 7 reference assemblies in runner in a way that will not cause side effects, I'm all ok with that. But just I don't wanna go down that rabbit hole again. |
Hello @yazeedobaid, thanks for explaining the problem space. The best solution would be to use the reference assemblies of the currently used SDK (assuming it is 6 or higher). But that smells like a rabbit hole for sure 😅. |
- TOM 19.52, MSAL 4.48, PBI API 4.11, CsvHelper 30 - Pinned to .Net 6 to work around current Fake incompatibilities with .Net 7 (fsprojects/FAKE#2719, fsprojects/FAKE#2722)
Hello,
Before this I used
But when there is a Fake package in use in the target (such as I've tried multiple ways of declaring dependencies in paket.dependencies (in group, not in group, ..) but the result is always the same. All the code is in this PR MortalFlesh/console-style#19 (here is the error https://github.com/MortalFlesh/console-style/actions/runs/3583647906/jobs/6029331205) Locally it behaves the same. Am I doing something wrong? |
@MortalFlesh I cloned the repository you provided on Could you please remove the |
Well.. I still can't understand, how it worked for you @yazeedobaid :) I've found a problem and fixed it. Problem was in the So now I can use the build project and I confirm it works on net 7. |
I encountered this issue after upgrading FAKE from 5.23.1 to 6.0.0:
The message confuses me, because I have all the runtimes and SDKs:
I am using the build.fsx-way of running FAKE in many of my projects and would prefer to keep using it. The only workaround I found is to downgrade FAKE to 5.23.1. Adding a global.json file fixing the SDK version to v6 like this {
"sdk": {
"version": "6.0.114"
}
} also fixes the FAKE script, but it breaks my project, I want to use SDK v7. Are there any other workarounds? |
During the upgrade of dependencies of FAKE and Paket.Core in FAKE we had to drop support for NETSTANDARD2.0 in FAKE runner and use .NET 6 reference assemblies. We choose .NET 6 since it is the current LTS release. The SDK resolver in FAKE runner look at the global.json file in the project, and setting it to .NET 7 which is not matching what is pinned will result in that error. The other workaround is to convert the build script to a dedicated build project as explained here. |
@yazeedobaid sorry, I don't quite get your explanation for 2 reasons:
|
@otto-gebb so FAKE runner now uses .NET host to get the current version of .NET SDK using In your case, you have .NET 6 and .NET 7 installed on the machine, but .NET host uses the latest SDK version, so it will be .NET 7, hence you get the error message. However, when you specified a global.json file and set it to The resolution algorithm first try to resolve .NET host from environment variables. I can suggest installing .NET host in another directory and install .NET 6 SDK only in that directory and set I know this is not a convenient way, but allowing runner to use different reference assemblies will be problematic. We tried before to combine .NETSTANDARD 2.0 and .NET 6 and we hit edge cases that resulted in dropping .NETSTANDRD 2.0 Another option I can suggest is to call your scripts directly using FSI instead of FAKE runner. However, if you are using Paket to resolve dependencies you need to tell FSI about Paket, you can do that by passing |
Just to add a +1 to this issue, we are in the exact same scenario @otto-gebb - building a net7 project, net6 and 7 installed on the build agent. If I now can't use fake-cli to build a .net7 project this seems a pretty severe limitation of it's usefulness for us. |
The workaround using a separate SDK v6 installation works for me. curl -s -L -O https://dot.net/v1/dotnet-install.sh
chmod +x ./dotnet-install.sh
./dotnet-install.sh --version "6.0.114" --install-dir "/tmp/dotnet6" \
--architecture "x64" --os "linux" --no-path
export DOTNET_HOST_PATH=/tmp/dotnet6/dotnet ; fake build |
Just adding my 2 cents here ... I had the same issue earlier with .Net7 support, and ended up dropping fake-cli and converting the fake build script to fsproj (targeting net6.0): That works well and leaves you all the options, including building .Net 7 projects via Fake. |
@mthierba Yes, that seems to be the best option, and exactly the one I was hoping to avoid, because for me it entails converting tens of scripts across the monorepo. |
this is a horrible option I have hundreds of repos to convert as a result of this change. |
To enhance this, whilst i understand V6 is a new major and breaking changes can occur. Also, a .net6 app (as compiled) should be able to run on .net7 runtime i thought? |
I believe you need a runtime for the same major .Net version to run a respective compiled app (that's a No to your question), but I couldn't find any hard evidence to support that. |
I know this will not be convenient for all use cases of FAKE runner and it was a trade-off to make. Let me please explain why we have gone with this approach. First, the FAKE runner was utilizing NETSTANDARD 2.0 reference assemblies when compiling the build script. NETSTANDARD 2.0 reference assemblies were distributed in a NuGet package and FAKE runner downloaded that package in the background if it is not in the host machine. So it did not cause issues until users starts to use APIs that are not in NETSTANDARD 2.0 reference assemblies and are in later versions of .NET. That trigger the need to upgrade the reference assemblies used in runner, so we tried to use both options, NETSTANDARD 2.0 and .NET 6. When we cannot find .NET 6 reference assemblies in host machine we revert back to NETSTANDARD 2.0. But that didn't last long, we had several issues in updating dependencies and supporting both reference assemblies. To that end, we decided to drop support for NETSTANDARD 2.0 reference assemblies and use .NET 6 ones. We didn't go with .NET 7 reference assemblies for two reasons:
I know the second reason has the same drawback on both sides since supporting either .NET version will leave the other without support, but .NET 6 won because it is the current LTS. And usually, users stay at LTS releases more than upgrading to newer ones (as far as I know). What also triggers this is the need to upgrade dependencies that the FAKE codebase relies on to catch up with the echo system in general and Paket.Core specifically. Also, In FAKE v6, we focused on FAKE modules more than runner, we cleaned them up, replaced obsolete APIs with alternatives, and update them since some were lacking behind services they support/interact with. We tried to not touch the runner as possible, but in the reference assembly part, we could not. Sorry for the historical writing, but I'm trying to explain why we went with this approach and this decision. If anyone have other alternatives/approaches please let's know. Thanks |
In this case, this would/should be the end of fake-cli. |
i agree with @akhansari |
Just my two cents from the sideline:
But I'll leave it to you to discuss, find other approaches. And up to @yazeedobaid to decide |
As it goes, I created a .net 7 dotnet tool as a wrapper around my script. Wonder. Could the CLI tool (only) multi target? |
On our side, we've started to remove the runner and switch to the build project. |
I don't know how cake does it, but to do compilation you need reference assemblies afaik, last time I tried to use runtime assemblies weird stuff happened |
After a quick look it seems like they use https://www.nuget.org/packages/Basic.Reference.Assemblies.Net60/ |
Also, DotNet.build doesn't seem to work with Microsoft.Build.Framework >=17.4.0 edit: #2722 |
While working on v6 we intended to focus on modules, not the runner. But while doing that, I was experimenting (a few experiments) with calling FSI and adding Paket to FSI as a compiler tool now that it accepts third-party dependency managers. Still facing some issues, but that will off-load a large portion of the current FAKE runner logic to FSI. One drawback I remember is assembly caching which FSI (as far as currently I know) doesn't have it, so each call will recompile the script. On the other hand, FAKE runner cache assembly and use it. When a new .NET version is released or Paket, and we try to update to them, the runner will need significant changes or debugging of multiple cases. And having a different version of These are the issues reported in runner currently that need to be addressed. I think keeping the runner with the LTS release support and trying to find solutions to this problem and other related problems by utilizing the new features that are being added to FSI is worth investigating (please correct me if I'm wrong). |
If anyone is interested in a quick conversion to an .fsx build:
|
@ray440 that is also a valid approach. We have this approach documented in the getting started guideline. That section is missing setting up FAKE context statements. We can accept a PR to enhance that approach in documentation if you would like to send one. Run FAKE using F# interactive (FSI) |
I'm joining the conversation, as we ran into the same problem after updating MSBuild to 17.5.
I'm not sure if I understand the description correctly, but it sounds off to me. If that's how it works today: would it be feasible to look for the latest supported dotnet SDK instead? This would at least not auto-break the runner when a new SDK becomes available, even though I can imagine that it can be tricky to resolve the SDKs. |
- Changed Fake build system from fsx script to fsproj. - see: https://fake.build/guide/getting-started.html#Different-ways-to-run-FAKE - this resolved compatibility issues that [Could not find a suitable .NET 6 runtime version matching SDK version: 7](fsprojects/FAKE#2719).
We have replaced Fake CLI with a project in order to use .NET 7.0. See fsprojects/FAKE#2719 and https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project . We are not sure if the resulting solution is optimal or "best practice".
The big problem with running FAKE via FSI is that FSI doesn't support authenticated feeds atm:
|
Thank you @ray440! It would be nice if the boilerplate could be simplified, but using #!/usr/bin/env -S dotnet fsi
#r "nuget: Fake.Core.Target"
// Boilerplate
System.Environment.GetCommandLineArgs()
|> Array.skip 2 // skip fsi.exe; build.fsx
|> Array.toList
|> Fake.Core.Context.FakeExecutionContext.Create false __SOURCE_FILE__
|> Fake.Core.Context.RuntimeContext.Fake
|> Fake.Core.Context.setExecutionContext
open Fake.Core
Target.create "clean" (fun _ ->
Trace.log "Cleaning stuff"
)
Target.create "build" (fun _ ->
Trace.log "Building the app"
)
Target.create "deploy" (fun _ ->
Trace.log "Deploying app"
)
open Fake.Core.TargetOperators
"clean"
==> "build"
==> "deploy"
Target.runOrDefaultWithArguments "build" |
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This addresses the issue of running .NET 6.0 with dotnet 7 SDK. See: * fsprojects/FAKE#2719 * https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project * https://github.com/TheAngryByrd/MiniScaffold/blob/master/build/build.fs
This could also help: #2777 |
Should work with latest version (6.1.1). |
Description
I cannot my FAKE using dotnet 7 sdk.
Repro steps
global.json:
install fake-cli
6.0.0-alpha003
.Create empty
fsx
file.Run
dotnet fake run build.fsx
Expected behavior
It should not fail.
Actual behavior
I find it weird to see a complaint about finding no dotnet 6 runtime.
The check above did find the correct
7.0.100
versionKnown workarounds
/
Related information
6.0.0-alpha003
The text was updated successfully, but these errors were encountered: