windows dotnet 未被识别为 cmdlet 的名称
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40568758/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dotnet is not recognized as the name of a cmdlet
提问by Shaun Luttin
We have downloaded and run DotNetCore.1.0.1-SDK.1.0.0.Preview2-003133-x64.exe
. After having closed and reopened our command prompt, running dotnet
gives the following output.
我们已经下载并运行DotNetCore.1.0.1-SDK.1.0.0.Preview2-003133-x64.exe
. 关闭并重新打开命令提示符后,运行dotnet
会提供以下输出。
The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program.
术语“dotnet”不被识别为 cmdlet、函数、脚本文件或可运行程序的名称。
We have tried the following:
我们尝试了以下方法:
- Uninstall all versions of Visual Studio.
- Uninstall all versions of .NET Core.
- Repair C++ Redistributable 2015 x86 & x64
- Restart the computer.
- Then reinstall the .NET Core SDK.
- 卸载所有版本的 Visual Studio。
- 卸载所有版本的 .NET Core。
- 修复 C++ Redistributable 2015 x86 & x64
- 重新启动计算机。
- 然后重新安装 .NET Core SDK。
This is the contents of C:/Program Files/dotnet
这是内容 C:/Program Files/dotnet
host
fxr
sdk
1.0.0-preview2-003133
shared
Microsoft.NETCore.App
swidtag
Microsoft .NET Core 1.0.1 - SDK 1.0.0 Preview 2-003133 (x64).swidtag
Our PATH includes C:\Program Files\dotnet\
我们的路径包括 C:\Program Files\dotnet\
采纳答案by Shaun Luttin
After again coming across this problem, we found the answer here.
再次遇到这个问题后,我们在这里找到了答案。
Open Programs and Features, choose Microsoft Visual C++ Redistributable (x86), click Uninstall and then choose Repair. After repairing it (and the x64 version if you have it), reinstall or repair the installation of the .NET Core SDK 1.0.1.
打开程序和功能,选择 Microsoft Visual C++ Redistributable (x86),单击卸载,然后选择修复。修复后(如果有 x64 版本),重新安装或修复 .NET Core SDK 1.0.1 的安装。
回答by Papa Stahl
Also ensure that "C:\Program Files\dotnet"
is part of the "path" system environment variable.
还要确保它"C:\Program Files\dotnet"
是“路径”系统环境变量的一部分。
After uninstalling previous SDK versions, it had disappeared from mine.
卸载以前的 SDK 版本后,它从我的中消失了。
回答by Jitender Kumar
This error also occurs if .Net Core is not installed on your machine. To verify it, please run the command dotnet --help
from Windows PowerShell or VS Code terminal. If .Net Core is installed then you will see the output, else the same error. If you see the same error then:
如果您的计算机上未安装 .Net Core,也会发生此错误。要验证它,请dotnet --help
从 Windows PowerShell 或 VS Code 终端运行命令。如果安装了 .Net Core,那么您将看到输出,否则会出现相同的错误。如果您看到相同的错误,则:
- Please download and install it from here.
- Then close the CLI or Code editor you are using.
Re-open it again, run the following command:
dotnet new webApp -o aspnetcoreapp
- 请从这里下载并安装它。
- 然后关闭您正在使用的 CLI 或代码编辑器。
再次重新打开,运行以下命令:
dotnet new webApp -o aspnetcoreapp
It will hopefully let you get rid of the problem.
它有望让你摆脱这个问题。
回答by dannboy
In my case the issue had to do with the x64vs. x86discrepancy.
My path had x86 in it. I manually changed it to "Program Files" rather than "Program Files (x86) and it started working again.
就我而言,问题与x64与x86 的差异有关。
我的路径中有 x86。我手动将其更改为“程序文件”而不是“程序文件(x86)”,然后它又开始工作了。
回答by mark
Go to Apps and Features, Search for Microsoft Visual C++ Redistributable 2015 Click the modify button and then click repair, do this for both versions of Microsoft Visual C++ Redistributable 2015. It should then prompt you to restart device. This worked for me!!
转到应用程序和功能,搜索 Microsoft Visual C++ Redistributable 2015 单击修改按钮,然后单击修复,对 Microsoft Visual C++ Redistributable 2015 的两个版本执行此操作。然后它会提示您重新启动设备。这对我有用!!