I am trying to get my dotnet
CLI working. Everytime I invoke it, no matter the command it attempts to install .NET Framework 3.5, fails, and quits. Example:
PS C:\> dotnet --version
Installing .NET Framework 3.5...
Deployment Image Servicing and Management tool
Version 10.0.19041.844
Image Version: 10.0.19044.1348
Enabling feature(s)
[===================100.0%====================]
The operation completed successfully.
.NET Framework 3.5 should be installed
No installation media found!
Insert DVD or USB flash drive and run this file once again.
Press any key to continue . . .
I have used the dotnet-core-uninstall
tool to remove everything that it can. I have uninstalled Visual Studio 2019 and 2017 and deleted the /.dotnet
folder. The dotnet
command issue persists with the same exact output, I don't even want 3.5 because that's not what my projects use (is that what the CLI runs on???). I don't know where it is pointing to or how to check and my google-fu powers have been exhausted.
I also do not have access to edit the system environment variables directly and have to use powershell to do so
FIXED
Turns out there was a C:\windows\dotnet.bat
file that was taking precedence over the executables that get installed with any sdk. Deleting it fixed my problem.
CodePudding user response:
The problem turned out to be a stray dotnet.bat
file situated in a directory that preceded that of the desired dotnet.exe
CLI in your $env:PATH
variable, C:\windows\dotnet.bat
Removing the batch file fixed the problem (calling dotnet.exe
- i.e. with the filename extension - would have bypassed the problem).
The problem was discovered via the following Get-Command
call, which lists all command forms / executable paths for the name dotnet
, with the effective one listed first:
Get-Command dotnet -All