Milos Tanaskovic
Milos Tanaskovic

Reputation: 55

It was not possible to run: dotnet run in visual studio code (macOS)

I have installed:

Host (useful for support):
  Version: 6.0.1
  Commit:  3a25a7f1cc

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

but, when I run: dotnet run show this message ->

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 'run' 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

if you have any suggestion how to fix it and run API? Best! 🤗

Upvotes: 4

Views: 2860

Answers (2)

Milos Tanaskovic
Milos Tanaskovic

Reputation: 55

I found issue and fix it. it works for me now. just install dotnet-sdk-yourversion.

brew tap isen-ng/dotnet-sdk-versions
brew install --cask dotnet-sdk2-2-100

dotnet --list-sdks

You can find it here: https://github.com/isen-ng/homebrew-dotnet-sdk-versions

Upvotes: 0

omajid
omajid

Reputation: 15203

It's a common cause of confusion that the dotnet run command needs an SDK to work. dotnet run, unlike what the name might suggest, is a command for developers working on their applications. It rebuilds and runs their application, during a development phase.

If you already have a .NET application built (or published as it's technically called) and you just want to run it, you should use this style of command: dotnet /path/to/your.dll. That is, just run dotnet against the main dll of the application.

Upvotes: 1

Related Questions