setup-dotnet: Cannot Find hostfxr.dll

Not completely sure if related to this action, but my best guess the issue is related to https://github.com/actions/setup-dotnet/pull/12#issuecomment-519660629.

Using: actions/setup-dotnet@v1.1.0
Run wyam
  wyam
   shell: C:\Program Files\PowerShell\6\pwsh.EXE -command ". '{0}'"
  env:
    DOTNET_ROOT: C:\hostedtoolcache\windows\dncs
A fatal error occurred, the required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:\Users\runneradmin\.dotnet\tools\.store\wyam.tool\2.2.4\wyam.tool\2.2.4\tools\netcoreapp2.1\any\].
If this is a framework-dependent application, install the runtime in the default location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 21 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for the confirmation @biom3tric - I feel like the default should have worked as this change was made - https://github.com/actions/setup-dotnet/pull/12/commits/ff36c3f74808c58fe86e008c9df007eb630ffbf6 (updated DOTNET_ROOT to be /opt/hostedtoolcache/dncs/ instead of /opt/hostedtoolcache/dncs/version/arch/).

@damccorm it seems we need to be pointing to the versioned folder - the cli for 2.1 and 2.2 sdk’s don’t know how to resolve the correct version.

Using v1.1.0, i had to do this to make global tools work

export PATH="$PATH:$HOME/.dotnet/tools"
export DOTNET_ROOT=$DOTNET_ROOT/2.2.401/x64/

The default DOTNET_ROOT variable stops to /opt/hostedtoolcache/dncs/, instead of going into the version and x64 folder

@roji are you pinning to a specific commit? If so, you just need to update to a version which contains the fix. E.g.

- uses: actions/setup-dotnet@bb95ce727fd49ec1a65933419cc7c91747785302

@JSkimming I believe that DOTNET_ROOT variable is required for global tools to launch, I’m just wondering if it’s set to the wrong path.