You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifically because the dotnet-ilverify info in "C:\Users\clovett.dotnet\toolResolverCache\1\dotnet-ilverify" contains stale information "PathToExecutable":"D:\git\coyote\packages\dotnet-ilverify\6.0.0\tools/net6.0/any/ILVerify.dll" (this path no longer exists because I moved the repo to a different place on my hard drive).
What it could do is detect that this is a local tool request and that PathToExecutable is not in the local folder.
It could also detect that the PathToExecutable FOLDER doesn't exist and remove that from the cache all together (which is the workaround for me that got things working again).
Better yet, locally installed tools should not use ANY global information from "C:\Users\clovett.dotnet" so that I can get 100% reproduceable environment when I do a fresh git clone, which is the point of locally installed dotnet tools in the first place.
I'm encountering the same issue when the %UserProfile%.nuget cache folder is cleared.
This creates the situation where the %UserProfile%.dotnet\toolResolverCache\1 contains a .tool file with a PathToExecutable referring to a dll that no longer exists in the .nuget folder.
I think dotnet tool restore is just checking the toolResolverCache for presence of the .tool file without checking that it contains valid paths.
The tool package cache should give a more usable error when the tool package cannot be found. At minimum it should remove the tool metadata from the cache.
More broadly, local tools should not store information in a shared global location - as it stands local tools of different versions in different repos clobber each other. There should be some level of context-awareness to the local tool install that prevents this clobbering.
This bug is really a pain when dotnet tools (in my case GitVersion.Tool) were installed and afterwards the global package cache path was changed.
It took me a while till I stumbled about this issue on GitHub that pointed me to my issue's cause.
Following I just explain what I did and tried to fix it.
I installed GitVersion.Tools with the original global package cache path (C:\Users\<user>\.nuget\packages\). So in folder C:\Users\<user>\.dotnet\toolResolverCache a file gitversion.tool was created with following content:
I executed GitVersion (dotnet gitversion) w/o any issues, all worked fine.
Then I had to change the global package cache folder to C:\PRJ\.nuget\packages\ and I tried to run GitVersion again that failed with: Run "dotnet tool restore" to make the "dotnet-gitversion" command available.
I executed dotnet tool restore w/o any success. So I uninstalled GitVersion.Tool and installed it again, w/o any success. It can be observed that the toolResolverCache entry does not change.
It still points to the original global cache path.
In the end I deleted the cache entry and installed the tool again to make it work.
It would be awesome if the cache would be cleaned up when a dotnet tool was uninstalled, so a reinstall would fix the issue.
Describe the bug
The dotnet tool install cache
C:\Users\clovett\.dotnet\toolResolverCache\1
can hold stale information that makesdotnet tool
commands fail.To Reproduce
Make sure you do not have the dotnet tool dotnet-ilverify installed globally.
Make sure the latest nuget.exe is in your PATH
Now move "c:\git\coyote" to "c:\git\microsoft\coyote"
Try step 4 again and you will see an error from "dotnet ilverify" saying it cannot find it.
Exceptions (if any)
GracefulException
Specifically because the dotnet-ilverify info in "C:\Users\clovett.dotnet\toolResolverCache\1\dotnet-ilverify" contains stale information "PathToExecutable":"D:\git\coyote\packages\dotnet-ilverify\6.0.0\tools/net6.0/any/ILVerify.dll" (this path no longer exists because I moved the repo to a different place on my hard drive).
What it could do is detect that this is a local tool request and that PathToExecutable is not in the local folder.
It could also detect that the PathToExecutable FOLDER doesn't exist and remove that from the cache all together (which is the workaround for me that got things working again).
Better yet, locally installed tools should not use ANY global information from "C:\Users\clovett.dotnet" so that I can get 100% reproduceable environment when I do a fresh git clone, which is the point of locally installed dotnet tools in the first place.
Further technical details
dotnet --info
VS 2022 version 17.2.6, Windows 11.
The text was updated successfully, but these errors were encountered: