Skip to content

[REGRESSION] FAKE 6.1.0 fails with dotnet preview versions #2803

@SteveGilham

Description

@SteveGilham

Description

Upgrading the AltCover build from v6.0.0 to v6.1.0, the first use of Fake.DotNet.DotNet.exec fails when parsing the version string in global.json. The same is true for other APIs, like DotNet.restore

Repro steps

  1. Install SDK 9.0.100-preview.6.24328.19
  2. Invoke it with a global.json like
{
  "sdk": {
    "version": "9.0.100-preview.6.24328.19",
    "rollForward": "latestMinor"
  }
}
  1. Run a command with DotNet.exec

Expected behavior

It just works, i.e. unchanged since v 6.0.0

Actual behavior

Exception thrown

Unhandled exception. System.TypeInitializationException: The type initializer for 'AltCover.Targets' threw an exception.
 ---> System.TypeInitializationException: The type initializer for '<StartupCode$build>.$Targets' threw an exception.
 ---> System.Exception: Could not parse `sdk.version` from global.json at 'C:\Users\email\Documents\Github\altcover\global.json': Version string portion was too short or too long. (Parameter 'input')
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1448.Invoke(String message)
   at Fake.DotNet.DotNet.tryGetSDKVersionFromGlobalJsonDir(String startDir) in D:\a\FAKE\FAKE\src\app\Fake.DotNet.Cli\DotNet.fs:line 77
   at Fake.DotNet.DotNet.Options.Create() in D:\a\FAKE\FAKE\src\app\Fake.DotNet.Cli\DotNet.fs:line 546
   at Fake.DotNet.DotNet.exec(FSharpFunc`2 buildOptions, String command, String args) in D:\a\FAKE\FAKE\src\app\Fake.DotNet.Cli\DotNet.fs:line 772
   at <StartupCode$build>.$Targets..cctor() in C:\Users\email\Documents\Github\altcover\Build\targets.fs:line 174

Known workarounds

Revert to 6.0.0

Related information

  • Operating system - Windows 11
  • Branch - using the 6.1.0 release from NuGet
  • .NET Runtime, CoreCLR or Mono Version - dotnet SDK 9.0.100-preview.6.24328.19
  • Indications of severity - complete stopper for pre-release development
  • Version of FAKE (4.X, 5.X, 6.x) - 6.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions