Permission Denied or Access Denied when running a global dotnet tool
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
(Some) dotnet tools installed as global cannot be used due to an `Access Denied` in cmd or
`Bash: /c/Users/MyUser/.dotnet/tools/coderiff: Permission denied` in Git Bash.
This problem is not happening with other dotnet tools such as `dotnet-ef`
### To Reproduce
View this sample public repository that generates a dotnet tool and publishes it in nuget.org:
https://github.com/coderiff-tech/coderiff-toolkit/tree/46e63a7e95aeed0e42154b90ddaa726e105efa54
The sample has been created following instructions at https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create
Install the sample dotnet tool globally, which should be available as it's in nuget.org
```
C:\ dotnet tool install -g Coderiff.Cli
You can invoke the tool using the following command: coderiff
Tool 'coderiff.cli' (version '0.1.9') was successfully installed.
```
Try to run the tool
```
C:\ coderiff
Access is denied.
```
Try to run it with GitBash
```
$ coderiff
bash: /c/Users/MyUser/.dotnet/tools/coderiff: Permission denied
```
Now, if I attempt to install another tool, such as dotnet-ef, I don't experience the same problem. **Is the above tool missing something which is causing this problem with dotnet CLI?**
```
C:\ dotnet tool install -g dotnet-ef
You can invoke the tool using the following command: dotnet-ef
Tool 'dotnet-ef' (version '8.0.6') was successfully installed.
```
And no errors when running
```
C:\ dotnet-ef
Entity Framework Core .NET Command-line Tools 8.0.6
```
### Further technical details
```
C:\ dotnet --version
8.0.302
```
in Windows 11.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.