Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the dotnet command executable located on Windows?

I am exploring the new Entity Framework Core (NOT in conjunction with ASP.Net, what I am coding is just a WinForms app) and found some tutorials mentioning a dotnet command line command needed to create "migrations". When I try it, however, it says 'dotnet' is not recognized as an internal or external command, operable program or batch file. I have searched my hard drive for "dotnet.exe", "dotnet.bat" and "dotnet.cmd" but have found nothing. I use Visual Studio 2015 Community Edition. Where do I find this command executable? What am I to add to the %PATH% environment variable for it to work?

like image 387
Ivan Avatar asked Mar 03 '17 21:03

Ivan


People also ask

How do I find .NET location?

You can check your installed versions of . NET by navigating to Microsoft.NET\Framework under your Windows folders. The complete path is usually 'C:\Windows\Microsoft.NET\Framework.

What is the dotnet exe?

dotnet.exe , installed under C:\Program Files\dotnet is a (command line) tool for. managing .NET source code and binaries. running applications ( dotnet.exe anApp.dll )


2 Answers

dotnet.exe is located in

C:\Program Files\dotnet> 

If you are using command prompt and getting message that 'dotnet' is not recognized as an internal or external command, operable program or batch file" then first check the above path. If you found the above path then just copy it and set it as an environment variable of your PC.

Steps:

  1. Open control panel>System and Security>System

  2. Click on Advanced system settings

  3. In advanced section, click in Environment Variables

  4. In System variables, select path and edit

  5. After semicolon, write "C:\Program Files\dotnet"

  6. Click on Ok button till end.

now to check whether its working on not. Just open command propmpt and type

dotnet --version 

This will show the dotnet version installed in your PC.

like image 165
Manish Jain Avatar answered Oct 21 '22 00:10

Manish Jain


I've just found the answer myself. It seems like the dotnettool does not get installed with Visual Studio. Installing .NET Core tools preview for Visual Studio (direct link to the .NET Core 1.0.1 tools Preview 2: DotNetCore.1.0.1-VS2015Tools.Preview2.0.3.exe) resolved the problem by adding %ProgramFiles%\dotnet\dotnet.exe.

I have faced another problem after this, however: the dotnet tool running but saying No executable found matching command "dotnet-ef" but this is a matter of another question. I will, however, share the solution here once I find it.

UPDATE:

As promised, here are the question and the answer about the thext problem I have faced (the No executable found matching command "dotnet-ef" error).

And here is the solution for the next one (the ... violates the constraint of type 'TContext' error)

like image 20
Ivan Avatar answered Oct 21 '22 01:10

Ivan