Skip to content

'dotnet tool install -g cake' results in System.IO.DirectoryNotFoundException #48781

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

Open
rolfbjarne opened this issue Apr 30, 2025 · 3 comments

Comments

@rolfbjarne
Copy link
Member

Description

$ dotnet tool install -g cake
Unhandled exception: System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/rolf/.dotnet/tools/.store/cake/1.3.0/cake/1.3.0/tools'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.GetDirectories(String path, String searchPattern, EnumerationOptions enumerationOptions)
   at Microsoft.DotNet.ToolPackage.ToolPackageInstance..ctor(PackageId id, NuGetVersion version, DirectoryPath packageDirectory, DirectoryPath assetsJsonParentDirectory)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass9_0.<InstallPackage>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass25_0.<ExecuteInstallCommand>b__1()
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction, PackageId packageId)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.ExecuteInstallCommand(PackageId packageId)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at System.CommandLine.ParseResult.Invoke()
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

Reproduction Steps

No idea how to reproduce, it looks like some bad state on my machine.

Expected behavior

Either success or an actionable/helpful error message.

Actual behavior

An exception message that's not very helpful.

Regression?

No response

Known Workarounds

No response

Configuration

$ dotnet --info
.NET SDK:
 Version:           9.0.203
 Commit:            dc7acfa194
 Workload version:  9.0.200-manifests.78a0f7ac
 MSBuild version:   17.13.20+a4ef1e90f

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  15.4
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/9.0.203/

.NET workloads installed:
 [macos]
   Installation Source: SDK 9.0.200
   Manifest Version:    15.4.9288/9.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.macos/15.4.9288/WorkloadManifest.json
   Install Type:        FileBased

 [maui-tizen]
   Installation Source: SDK 9.0.200
   Manifest Version:    9.0.51/9.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.51/WorkloadManifest.json
   Install Type:        FileBased

 [maui-maccatalyst]
   Installation Source: SDK 9.0.200
   Manifest Version:    9.0.51/9.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.51/WorkloadManifest.json
   Install Type:        FileBased

 [maui-android]
   Installation Source: SDK 9.0.200
   Manifest Version:    9.0.51/9.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.51/WorkloadManifest.json
   Install Type:        FileBased

 [ios]
   Installation Source: SDK 9.0.200
   Manifest Version:    18.4.9288/9.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.ios/18.4.9288/WorkloadManifest.json
   Install Type:        FileBased

Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.4
  Architecture: arm64
  Commit:       f57e6dc747

.NET SDKs installed:
  7.0.410 [/usr/local/share/dotnet/sdk]
  8.0.304 [/usr/local/share/dotnet/sdk]
  8.0.402 [/usr/local/share/dotnet/sdk]
  9.0.100 [/usr/local/share/dotnet/sdk]
  9.0.102 [/usr/local/share/dotnet/sdk]
  9.0.103 [/usr/local/share/dotnet/sdk]
  9.0.106 [/usr/local/share/dotnet/sdk]
  9.0.203 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.36 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged Request triage from a team member label Apr 30, 2025
@rolfbjarne
Copy link
Member Author

The /Users/rolf/.dotnet/tools/.store/cake directory doesn't exist on my machine:

$ find /Users/rolf/.dotnet/tools/.store/cake
find: /Users/rolf/.dotnet/tools/.store/cake: No such file or directory

@jeffschwMSFT jeffschwMSFT transferred this issue from dotnet/runtime Apr 30, 2025
@nagilson
Copy link
Member

Interesting, do you have a reference to that folder in your PATH? I wonder if you previously configured a dotnet global tool that went there, but then you uninstalled that version of dotnet or removed the tools.

@nagilson nagilson added needs-info and removed untriaged Request triage from a team member labels May 13, 2025
@rolfbjarne
Copy link
Member Author

Interesting, do you have a reference to that folder in your PATH? I wonder if you previously configured a dotnet global tool that went there, but then you uninstalled that version of dotnet or removed the tools.

/Users/rolf/.dotnet/tools is in my PATH, but not /Users/rolf/.dotnet/tools/.store (or any subdirectory thereof).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants