title: Error installing .NET Core global tools: "Could not find a part of the path..."
body: <p>.NET Core global tool installation fails on some Windows computers with this error:</p>
  
  <pre><code>Failed to install tool package 'amazon.lambda.tools': Could not find a part of the path 'C:\Users\myUser\.dotnet\tools\.store\.stage\xxx.yyy\amazon.lambda.tools'.
  Tool 'amazon.lambda.tools' failed to install. This failure may have been caused by:
  
  * You are attempting to install a preview release and did not use the --version option to specify the version.
  * A package by this name was found, but it was not a .NET Core tool.
  * The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
  * You mistyped the name of the tool.
  
  For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
  </code></pre>
  
  <p>The above example attempts to install Amazon.Lambda.Tools; but other common tools (e.g. dotnetsay) give the same result.</p>
  
  <p>I have only observed this in one environment: a Windows Server 2016 virtual machine which my development team uses as a TFS 2017 build agent. The server has Visual Studio 2017 and 2019 installed, as well as Visual Studio 2017 and 2019 Build Tools. The server is not behind a proxy. Other Windows Server 2016 virtual machines on the same VLAN are able to perform the installation successfully.</p>
  
  <pre><code>C:\Users\myUser&gt;dotnet --info
  .NET Core SDK (reflecting any global.json):
   Version:   3.1.101
   Commit:    b377529961
  
  Runtime Environment:
   OS Name:     Windows
   OS Version:  10.0.14393
   OS Platform: Windows
   RID:         win10-x64
   Base Path:   C:\Program Files\dotnet\sdk\3.1.101\
  
  Host (useful for support):
    Version: 3.1.1
    Commit:  a1388f194c
  
  .NET Core SDKs installed:
    3.1.101 [C:\Program Files\dotnet\sdk]
  
  .NET Core runtimes installed:
    Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
    Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 3.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 3.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.WindowsDesktop.App 3.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  
  </code></pre>
  
  <p>The following were unsuccessful:</p>
  
  <ul>
  <li>Running as admin.</li>
  <li>Running as various accounts (some have '.' in the user name, some don't).</li>
  <li>Uninstalling .NET Core SDKs/runtimes, Visual Studio, then installing .NET Core by itself and attempting the tool install.</li>
  <li>Rolling back to .NET Core 3.1.101 (original attempt was on 3.1.102).</li>
  <li>Copying the .nupkg from a computer where the installation succeeded and using it as a file argument to <code>--add-source</code> (long-shot, I know).</li>
  <li>Specifying a specific <code>--version</code> during the install.</li>
  </ul>
  
  <p>I have identified a workaround: copy C:\Users\myUser.dotnet\tools from a computer where the installation succeeds to the same location on the computer where it fails. Doing so allows the use of the global tool as if the installation had succeeded. This is, of course, not an optimal solution, but I mention it in case it leads to a better understanding of the underlying problem.</p>
  
  <p>I don't know the inner workings of the <code>dotnet tool install</code> command, but I can easily imagine "Could not find a part of the path..." to be the failure of a method which expects some downloaded content to be placed in a temporary folder, but finds that wasn't the case. If that's true, then this could be (as the error suggests) the result of a failed download...the logs just don't tell me what resource it failed to download, and I haven't been able to locate the .nupkg for Amazon.Lambda.Tools on Github (to try specifying the URL manually).</p>
  
  <p>Is there a known resolution to this issue? If not, then are there any further steps I might take to diagnose the tool installation? I am convinced that the reported error "Could not find a part of the path..." is merely a side-effect of an error which is not visible to me via the console.</p>