dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.88k stars 4.89k forks source link

No compatible SDK found #7753

Closed Amoranemix closed 2 years ago

Amoranemix commented 2 years ago

Dear supporters,

Problem encountered on https://dotnet.microsoft.com/en-us/learn/dotnet/hello-world-tutorial/create Operating System: windows 10

I am following a course on Test Driven software development on PluralSight. I was asked to install MS Visual Studion Code and .NET Core, which I have done. The verification for .NET Core installation (typing dotnet in cmd) passed.

Since stuff rarely works, I usually try to get some background understanding, so I decided to follow the .NET Core tutorial.

The command dotnet new console -o MyApp -f net6.0

yields Could not execute because the application was not found or a compatible .NET SDK is not installed. Possible reasons for this include:

The MyApp folder was not created.

Indeed. As far as know, I haven’t installed any .NET SDKs and I was never asked to.

mairaw commented 2 years ago

Can you check what dotnet --info returns? Maybe you installed just the runtime and not the SDK? In order to develop code, you'd the SDK as well.

The previous step ask you to install the SDK: https://dotnet.microsoft.com/en-us/learn/dotnet/hello-world-tutorial/install

Amoranemix commented 2 years ago

Thanks for your response.

Sorry, I was mistaken. I have actually installed SDK 6.0. (I apparently thought Core was not SDK.)

Typing in the command prompt dotnet --info yields Version: 6.0.3 Commit: c24d9a9c91

.NET SDKs installed: No SDKs were found.

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download

I dotnet-sdk-6.0.400-win-x64.exe again. (Version 6.0.4 while info mentions version 6.0.3) In the Microsoft .NET DSK 6.0.400 installer pick Repair. It was allegedly successful. Dotnet --info still yields the same. dotnet new console -o MyApp -f net6.0 again yields the error.

I go to aka.ms/dotnet-download,but it is unclear what I am supposed to download. So in stead I uninstall it with Microsoft .NET DSK 6.0.400 installer.

dotnet –info still yields the same result.

So I uninstall Microsoft .NET Runtime 6.0.3 (x64) and (x86). (There are 2 more .NET applications I leave.) Then I install Microsoft .NET DSK 6.0.400 again.

dotnet --info again yields the same (version 6.0.3).

The command dotnet new console -o MyApp -f net6.0 again yields what looks like the same response.

mairaw commented 2 years ago

This might be an issue with PATH.

Check the output of the where.exe dotnet command and if your system is x64 and the x86 path returns first, please follow the steps at https://github.com/dotnet/core/issues/5962#issuecomment-780084535 to fix the issue.

Amoranemix commented 2 years ago

I have an x64 system.

where.exe dotnet yields C:\Program Files (x86)\dotnet\dotnet.exe C:\Program Files\dotnet\dotnet.exe

My PATH System Variable is (no, I don’t get the fancy table) : %JAVA_HOME%\bin;%MAVEN_HOME%\bin;TRICENTIS_SEARCH%;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;

Thus, the pertinent paths are in there, but I copy C:\Program Files\dotnet\ to before C:\Program Files (x86)\dotnet\

where.ex dotnet still lists the x86 one first.

dotnet --info still yields the same, as does dotnet new console -o MyApp -f net6.0.

mairaw commented 2 years ago

So, certainly it's the issue with the path that you're running into.

Make sure the path is updated with C:\Program Files\dotnet coming up first.

Amoranemix commented 2 years ago

I restart the computer.

I instruct where.exe dotnet Response : C:\Program Files\dotnet\dotnet.exe C:\Program Files (x86)\dotnet\dotnet.exe

dotnet –info yields .NET SDK (reflecting any global.json): Version: 6.0.400 Commit: 7771abd614

Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.400\

global.json file: Not found

Host: Version: 6.0.8 Architecture: x64 Commit: 55fb7ef977

.NET SDKs installed: 6.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Download .NET: https://aka.ms/dotnet-download

That is different than before.

I instruct dotnet new console -o MyApp -f net6.0

That yields much info than the animation shows in the command prompt and a folder in the wrong place. I moved it to a different location.

The rest of the tutorial worked. Thanks for your help.

Amoranemix commented 2 years ago

This is a new issue, but it is also about some version not being found.

The teacher gave some C# code in Visual Studio and used dotnet watch test in the command prompt. Then good stuff happened.

Wen I instruct C:\Users\Knarf\Documents\School\Informatica\Software Testing\TDD - The Big Picture\Code examples\TDD-TheBigPicture-master\FizzBuzz-Start\FizzBuzz.Tests>dotnet watch test I get [stuff about framework no longer being supported and some other stuff] Starting test execution, please wait... A total of 1 test files matched the specified pattern. Testhost process exited with error: You must install or update .NET to run this application. App: C:\Users\Knarf.nuget\packages\microsoft.testplatform.testhost\15.0.0\lib\netstandard1.5\testhost.dll Architecture: x64 Framework: 'Microsoft.NETCore.App', version '1.1.2' (x64) .NET location: C:\Program Files\dotnet\ The following frameworks were found: 6.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.8 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Learn about framework resolution: https://aka.ms/dotnet/app-launch-failed To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=1.1.2&arch=x64&rid=win10-x64 . Please check the diagnostic logs for more information.

Test Run Aborted. dotnet watch ❌ Exited with error code 1

I tried some stuff on docs.microsoft.com/nl-nl/dotnet/core/runtime-discovery/troubleshoot-app-launch?pivots=os-windows to resolve the issue. (en-us i.s.o. nl-nl looks like the English version of the page.)

The link leads to a download of version 1.1.13, which is allegedly outdated. Should I install it anyway ?

I didn’t try ‘Binaire bestanden downloaden’ because it told me to use a file (dotnet-sdk-6.0.400-win-x64.zip) that looks identical to what I already have.

I also didn’t try forward-rolling because of the warning that that could change the behaviour of the application.

How can I use dotnet watch test on the exercise project ?

rzikm commented 2 years ago

Closing since the original problem was solved