dotnet tool install fails
See original GitHub issueI get error when installing dotnet tool
and seem related to long path(not sure if it’s related to https://github.com/dotnet/sdk/issues/10708)
C:\git\coverlet\test\coverlet.integration.tests\bin\Debug\netcoreapp3.1\d366c85b6c244c8b86cca264210c9e9c (fixnightly -> origin)
λ dotnet tool install coverlet.console --version 1.7.2-preview-0001-g96f4e91319 --tool-path C:\git\coverlet\test\coverlet.integration.tests\bin\Debug\netcoreapp3.1\d366c85b6c244c8b86cca264210c9e9c\coverletTool
Microsoft.NET.HostModel.HResultException: 80070002
at Microsoft.NET.HostModel.ResourceUpdater.ThrowExceptionForLastWin32Error()
at Microsoft.NET.HostModel.ResourceUpdater.AddResourcesFromPEImage(String peFile)
at Microsoft.NET.HostModel.AppHost.HostWriter.<>c__DisplayClass2_0.<CreateAppHost>g__UpdateResources|1()
at Microsoft.NET.HostModel.RetryUtil.RetryOnWin32Error(Action func)
at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom)
at Microsoft.DotNet.ShellShim.AppHostShellShimMaker.CreateApphostShellShim(FilePath entryPoint, FilePath shimPath)
at Microsoft.DotNet.ShellShim.ShellShimRepository.<>c__DisplayClass6_0.<CreateShim>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.<>c__DisplayClass2_0.<Run>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Cli.TransactionalAction.Run(Action action, Action commit, Action rollback)
at Microsoft.DotNet.ShellShim.ShellShimRepository.CreateShim(FilePath targetExecutablePath, ToolCommandName commandName, IReadOnlyList`1 packagedShims)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallCommand.Execute()
at Microsoft.DotNet.Cli.DotNetTopLevelCommandBase.RunCommand(String[] args)
at Microsoft.DotNet.Tools.Tool.ToolCommand.Run(String[] args)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
C:\git\coverlet\test\coverlet.integration.tests\bin\Debug\netcoreapp3.1\d366c85b6c244c8b86cca264210c9e9c (fixnightly -> origin)
λ dotnet tool install coverlet.console --version 1.7.2-preview-0001-g96f4e91319 --tool-path C:\git\coverlet\test\coverlet.integration.tests\bin\Debug\d366c85b6c244c8b86cca264210c9e9c\coverletTool
You can invoke the tool using the following command: coverlet
Tool 'coverlet.console' (version '1.7.2-preview-0001-g96f4e91319') was successfully installed.
As you can see if I make path shorter it works. I’m ok with that, but error is a bit hidden and if I search around I found that code related to windows update, so it’s not clear the workaround.
λ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 5.0.0-preview.2.20160.6
Commit: d12f79a4d1
.NET Core SDKs installed:
2.2.207 [C:\Program Files\dotnet\sdk]
3.0.103 [C:\Program Files\dotnet\sdk]
3.1.200-preview-015002 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015048 [C:\Program Files\dotnet\sdk]
5.0.100-preview.2.20176.6 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.2.20167.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Unable to install any tools using dotnet tool install #10295
This failure may have been caused by: * You are attempting to install a preview release and did not use the --version option...
Read more >Cannot install anything using dotnet tool install command
Tool 'dotnet-ef' failed to install. This failure may have been caused by: * You are attempting to install a preview release and did...
Read more >Troubleshoot .NET tool usage issues
A common reason for failure is that the tool name isn't correct. This can happen because of mistyping, or because the tool has...
Read more >Unable to install dotnet tool from private nuget feed
I have a dotnet tool that is published as a Nuget package to a private feed. From a YAML pipeline I would like...
Read more >Dotnet tool install dotnet-ef failing with unauthorized
Dotnet tool install dotnet-ef failing with unauthorized ... Based on the error message and description, there were a few things to validate:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@radical I believe https://github.com/dotnet/arcade/pull/8160 should fix the problem.
We ran into this as well and the culprit seems to be that the standard global tool installation uses very long paths to store the tools
so should you use a longer package id in your package because the package ID is stored twice you are quite likely to run into long path issues which causes this problem. The only way to install a tool is by not using the global flag but set the tool path to a shorter root path