我安装了用于windows的SDK5.0(就像这个视频中的https://youtu.be/a6WPeTG1QEk一样),它实际上位于C:\Programs \ dotnet下,但当我在cmd中输入dotnet new consol -o myApp时,它给出了以下错误:
> PS D:\Programme\VSCodeNetCoreTest> dotnet new console
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application 'new' does not exist.
* You intended to execute a .NET SDK command:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download(这是在VSCode中,没有-o myApp,但它在cmd中给出了相同的错误)我已经将dotnet目录添加到PATH,但它仍然不能运行。
我做错了什么?
发布于 2021-05-06 16:57:32
这里讨论了确切的细节:https://github.com/dotnet/sdk/issues/14916
TL:DR在程序文件和程序文件(X86)中有两个dotnet.exe文件,我必须删除这两个文件,然后通过Visual Studio2019重新安装(可能不是唯一的方法)。
现在,程序文件中只有一个dotnet.exe,它终于可以工作了。
发布于 2021-08-13 22:43:02
我只是遇到了同样的问题,无法在vscode或本地构建代理中使用dotnet构建,但我可以使用visual studio构建。
在bash中运行"dotnet build -v diag“时,我发现有一个环境变量"MSBuildSDKsPath”被设置为不存在的版本。
我尝试将其更改为不同的版本,但不起作用。最后,我删除了它,并修复了我的构建。
https://stackoverflow.com/questions/67413205
复制相似问题