Skip to content
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

Fake 5.22.0 is not respecting rollForward property in global.json #2678

Closed
InvisibleBacon opened this issue May 18, 2022 · 2 comments
Closed

Comments

@InvisibleBacon
Copy link

Description

I am having to specify a sdk version in global.json in order to force Fake to use something greater than netstandard2.0 since our fake script uses async (see #2659 (comment) for details).

I was hoping to not require all our devs (and build servers) to require a specific patch of the .NET 6 sdk so I added "rollForward": "latestPatch" to the global.json file. However I would get errors like this unless I had the exact SDK version installed:

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.2\ref\net6.0', please check installed SDK and runtime versions

Repro steps

NOTE: I am using the specific version numbers I tested with below, but this appears to be a general problem whenever you don't have the runtime installed that is associated with the SDK patch specified in global.json

  1. On a machine that does not have SDK 6.0.200 and also does not have the 6.0.2 runtime installed, but does have SDK 6.0.202 and runtime 6.0.4, use the specified global.json file:
{
  "sdk": {
    "version": "6.0.200",
    "rollForward": "latestPatch"
  }
}
  1. Run fake (I am including verbose output). You will get this output
resolved runtime version: 6.0.2
Resolved referenced SDK path: C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.2\ref\net6.0
...
There was a problem while setting up the environment, see standard error for details.
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.2\ref\net6.0', please check installed SDK and runtime versions

Expected behavior

It should have honored the rollForward prop and rolled forward to the 6.0.202 SDK and 6.0.4 runtime that I had installed.

I later learned that "rollForward": "latestPatch" is actually the default behavior if none is specified so ideally I shouldn't have had to do anything to get this behavior.

Actual behavior

See repro.

Known workarounds

Only workaround I know of is to require all devs to install a specific SDK version.

Related information

I did look at the source a bit and see that Fake is parsing the global.json file directly to determine the runtime. https://github.com/fsprojects/FAKE/blob/5.22.0/src/app/Fake.DotNet.Cli/DotNet.fs

Is there a way to rely on dotnet to give the appropriate sdk/runtime rather than parsing the file directly?

@github-actions
Copy link
Contributor

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

@InvisibleBacon
Copy link
Author

Ah.. well I see I should search through existing issues more carefully before creating a new one. This is a duplicate of #2641

aggieben added a commit to aggieben/MBrace.Core that referenced this issue Jul 21, 2022
…erKit shored up.

Might be worth moving the starter kit into the main repo.
Note the dogfooding paket group as well as the pinned SDK version in global.json; FAKE scripts wouldn't run at all without pinning the SDK version; see fsprojects/FAKE#2678.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant