Closed mclark1129 closed 2 years ago
Welcome to the FAKE community! Thank you so much for creating your first issue and therefore improving the project!
Same issue on my end as well, but in my case dotnet --info
claims that I have a 6.0.0 runtime installed (but the folders are not there for that one)
Similar issue - however, our default is not to have a global.json. In a gitpod env, even with the SDKs installed, have to have a global.json with the exact version of the sdk 6.0.101 for the build to work. Without global.json, get a cryptic
Script is not valid: unknown (1,0)-(1,0): Error FS0193: The module/namespace 'System' from compilation unit 'netstandard' did not contain the namespace, module or type 'IAsyncDisposable'
which might be resolving to netstandard2.0 instead of net 6.0
Why is this not yet labelled as a bug?
I can reproduce this with fake-cli
v5.22.0, OS Win10, I have .NET SDK v6.0.102 installed and unless my global.json
contains exactly this version, it fails with
There was a problem while setting up the environment:
-> Could not find referenced assemblies in path: 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.0\ref\net6.0', please check installed SDK and runtime versions
This is with global.json
:
{
"sdk": {
"version": "6.0.100"
}
}
I'm also encountering this fun bug in FsToolkit.ErrorHandling
There was a problem while setting up the environment:
-> Could not find referenced assemblies in path: '/opt/hostedtoolcache/dncs/x64/packs/Microsoft.NETCore.App.Ref/6.0.0/ref/net6.0', please check installed SDK and runtime versions
StackTrace:
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1439
at Fake.Runtime.FakeRuntime.retrieveInfosUncached@114(String cacheDir, Lazy`1 paketDependenciesFile, VerboseLevel logLevel, GroupName groupName, SdkAssemblyResolver sdkAssemblyResolver, FrameworkIdentifier framework, Rid rid, Rid ridNotVersionSpecific, Lazy`1 lockFile, Lazy`1 cache, Unit unitVar0) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\FakeRuntime.fs:line 202
at Fake.Runtime.FakeRuntime.getKnownDependencies@312-1.Invoke(Unit unitVar0) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\FakeRuntime.fs:line 312
at Fake.Runtime.CoreCache.getCached[a](FSharpFunc`2 getUncached, FSharpFunc`2 readFromCache, FSharpFunc`2 writeToCache, FSharpFunc`2 checkCacheUpToDate) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\CoreCache.fs:line 41
at Fake.Runtime.FakeRuntime.getKnownDependencies@310(String cacheDir, Lazy`1 paketDependenciesFile, VerboseLevel logLevel, GroupName groupName, FileInfo lockFilePath, String dependencyCacheHashFile, String dependencyCacheFile, SdkAssemblyResolver sdkAssemblyResolver, FrameworkIdentifier framework, Rid rid, Rid ridNotVersionSpecific, Lazy`1 lockFile, Lazy`1 cache, Lazy`1 writeIntellisenseTask, FSharpFunc`2 readFromCache, FSharpFunc`2 writeToCache, Unit unitVar0) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\FakeRuntime.fs:line 311
at Fake.Runtime.FakeRuntime.knownDependencies@320.Invoke(Unit unitVar) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\FakeRuntime.fs:line 320
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at Fake.Runtime.FakeRuntime.paketCachingProvider@329-5.Fake.Runtime.CoreCache.ICachingProvider.TryLoadCache(FakeContext context) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\FakeRuntime.fs:line 336
at Fake.Runtime.CoreCache.prepareContext(FakeConfig config, ICachingProvider cache) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\CoreCache.fs:line 482
at Fake.Runtime.CoreCache.runScriptWithCacheProviderExt(FakeConfig config, ICachingProvider cache) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\CoreCache.fs:line 508
at Fake.Runtime.FakeRuntime.runScript(PrepareInfo preparedScript) in D:\a\FAKE\FAKE\src\app\Fake.Runtime\FakeRuntime.fs:line 579
at Program.runOrBuild(RunArguments args) in D:\a\FAKE\FAKE\src\app\Fake.netcore\Program.fs:line 156
Hint: If you just upgraded the fake-runner you can try to remove the .fake directory and try again.
Was looking to see if I should log this - we use 'Scenario 3' (6.0.100
with roll forward latestFeature
), and updating to the latest CLI breaks.
I think the fix is hinted in this review comment: if we change to use dotnet --version
then we solve two problems at once: 1. we get a value if global.json
is missing and 2. we get the resolved version given what's installed, any global.json and any rollForward
value.
Hello, do you know when this fix will be released? Our software is running into the issue with rollForward
not being honored.
I do not, a PR for the alpha build is here https://github.com/fsprojects/FAKE/pull/2668 but it is blocked because the Mac OS tests are failing for reasons I can't personally reproduce (works on my fork!). That's basically where the fix has died for now, and my team has already started the process for moving to different build tooling.
@mclark1129 That's unfortunate. Thank you for your efforts here.. Hopefully progress will be made.
The build issue is now fixed and a new release is published.
Did it work for you @InvisibleBacon ? Seems like it's still not working for me. It still is unable to roll forward
Description
After upgrading to 5.21.0, our .NET 6 builds are failing due to the following error:
This appears to be due to the resolver not being able to resolve the correct Runtime version for the locally installed SDK. We are using
global.json
to specify an SDK version along withrollForward
to help manage any minor SDK version differences between development machines and build agents.Repro steps
The following steps will reproduce the issue outside of the FAKE pipeline by calling the appropriate methods on the
SdkAssemblyResolver
class:Setup: In an empty folder create
Resolver.fsx
with the following code:Note the currently installed .NET SDK(s) on your machine. The expected behavior as written assumes
6.0.101
, but this is also reproduceable with6.0.100
Scenario 1: No global.json
dotnet fsi Resolver.fsx
Expected behavior
Actual behavior
Scenario 2: Unknown SDK version with rollForward option
Add the following
global.json
to the workspacerun
dotnet fsi Resolver.fsx
Expected behavior
Actual behavior
Scenario 3: Valid SDK version, lower than installed version
Add the following
global.json
to the workspacerun
dotnet fsi Resolver.fsx
Expected behavior
Actual behavior
During the actual build this leads to a failure due to the fact that 6.0.0 is not installed:
Known Workarounds
Specify exact installed SDK in
global.json
ensure that version is installed across all machines building the projectRelated information
FAKE 5.21.0
Installed SDKs:
OS: Win 10