question

jorin avatar image
0 Votes"
jorin asked jorin commented

Locate the dotnet executable

I'm getting the dreaded "dotnet is not recognized" error, and I'm fairly sure the SDK is installed. Basically, how do I locate the executable file in Windows 10? Thanks in advance for your help.

 'dotnet' is not recognized as an internal or external command, operable program or batch file.
dotnet-csharp
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Check if you happen to use the wrong bitness of .NET Core SDK as discussed in this

0 Votes 0 ·

What SDK did you install?

0 Votes 0 ·
BruceBarker-8516 avatar image
0 Votes"
BruceBarker-8516 answered BruceBarker-8516 edited

if you used the default locations

the windows 64 bit sdk is in

c:\"Program Files"\dotnet

the windows 32 bit sdk is in :

c:\"Program Files (x86)"\dotnet

the mac sdk

 /usr/local/share/dotnet 


install:

download



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered karenpayneoregon edited

You need to add the path to environment variables if not running from the developer console

113064-figure1.png


From PowerShell (same from cmd but PowerShell is colored text)

113055-ps.png



figure1.png (35.1 KiB)
ps.png (27.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

jorin avatar image
0 Votes"
jorin answered jorin commented

That's the problem: I need to know where dotnet.exe is.

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It's always in the folder shown in my first reply.

 using System;
 using System.IO;
    
 namespace WhereIsDotNet
 {
     class Program
     {
         static void Main(string[] args)
         {
             Console.WriteLine(Helper.DotNetIsInstalled() ? "Yes" : "No");
             Console.ReadLine();
         }
     }
    
     class Helper
     {
         public static bool DotNetIsInstalled() => File.Exists("C:\\Program Files\\dotnet\\dotnet.exe");
     }
 }
0 Votes 0 ·

So why do you think it's a joke?


Also we can get versions installed

 using System;
 using System.IO;
    
 namespace WhereIsDotNet
 {
     class Program
     {
         static void Main(string[] args)
         {
             if (Helper.DotNetIsInstalled())
             {
                 foreach (var dirName in Helper.sdkArray)
                 {
    
                     try
                     {
                         Version version = new Version(Path.GetFileName(dirName));
                         Console.WriteLine(version);
                     }
                     catch (Exception ex)
                     {
                         // we hit perhaps the NuGet folder
                     }
    
    
    
                 }
             }
             Console.ReadLine();
         }
     }
    
     class Helper
     {
         public static bool DotNetIsInstalled() => File.Exists("C:\\Program Files\\dotnet\\dotnet.exe");
         public static string[] sdkArray = Directory.GetDirectories("C:\\Program Files\\dotnet\\sdk");
     }
 }



0 Votes 0 ·
jorin avatar image jorin karenpayneoregon ·

Yes ma'am, I think dotnet is a joke.

0 Votes 0 ·
Show more comments
jorin avatar image
0 Votes"
jorin answered

Which, I guess, means it isn't installed... so what do I download to make sure it is?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.