I've been using VS for Mac for a while now with EF Core 2.2 and everything's been going alright. Today I updated VS for Mac since it was really out of date, and after the update I can no longer run the dotnet ef command:
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET Core program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Note that this is .NET Core 2.2 and EF Core 2.2, not 3.0. Everything I've read online is specific to 3.0, so could someone please instruct me on how to get this command to finally work? Here are some things I've already tried:
wiping the packages and re-installing them
running dotnet restore
explicitly adding the Microsoft.EntityFrameworkCore.Design package
explicitly adding the Microsoft.EntityFrameworkCore.Tools package
explicitly re-installing Microsoft.EntityFrameworkCore
rebooting VS for Mac
rebooting the Mac itself
Had same issue too, you don't have to uninstall v3.0. Eventually found out that the dotnet ef isn't longer part of the .netcore SDK.
You will need to install the ef tool for the specific version you want (In my case, 2.2). Run the command below on terminal:
dotnet tool install --global --version 2.2 dotnet-ef
Note that I specified global, you can as well specify local.
You should get an output with some information on how to add it to your profile and finally run:
zsh -l
and export to PATH:
export PATH="$PATH:/Users/username/.dotnet/tools"
For more information:
https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet
Breaking changes in dotnet-ef
For those that are having this issue after switching to zsh (for example after upgrading to macOS Catalina): the default path for globally installed tools is not recognised by zsh and now requires to reference the relevant path in your profile (.zshrc).
This can be done by adding the following lines:
# Add .NET Core SDK global tools/packages
export PATH=$HOME/.dotnet/tools:$PATH"
See further background on why this was different from bash in: https://github.com/dotnet/cli/issues/9321
Figured it out. When I updated VS for Mac it installed .NETCore SDK v3.0, so every time I ran the dotnet command it was using the version 3 executable. After removing that SDK version (by following these instructions https://learn.microsoft.com/en-us/dotnet/core/versions/remove-runtime-sdk-versions?tabs=macos#uninstalling-net-core), it’s now using the correct version for the project and the dotnet ef command is working again
Try this:
dotnet tool uninstall dotnet-ef -g
dotnet tool install dotnet-ef -a arm64 -g
Related
I'm working on ASP.NET Project with .NET 5.0. For Database creation, I've run the command
dotnet tool install --global dotnet-ef
After the installing, when I run this command:
dotnet ef
I got that error
A fatal error occurred. The required library libhostfxr.dylib could
not be found. If this is a self-contained application, that library
should exist in
[/Users/afshalathar/.dotnet/tools/.store/dotnet-ef/6.0.0/dotnet-ef/6.0.0/tools/netcoreapp3.1/any/].
If this is a framework-dependent application, install the runtime in
the global location [/usr/local/share/dotnet/x64] or use the
DOTNET_ROOT environment variable to specify the runtime location or
register the runtime location in [/etc/dotnet/install_location].
The .NET runtime can be found at:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.11.1-x64&apphost_version=5.0.11
I'm using Mac M1
As mentioned here, first uninstall dotnet-ef and then reinstall it using the -a arm64 option:
dotnet tool uninstall dotnet-ef --global
dotnet tool install dotnet-ef --global -a arm64
This worked for me.
Update
This fixes the problem permanently:
dotnet tool uninstall dotnet-ef -g
dotnet tool install dotnet-ef -a arm64 -g
You can also try installing EF tool locally
CD to your source directory and do this:
dotnet new tool-manifest
dotnet tool install dotnet-ef
In this way, it works even with the .Net 5/6 arm64.
There's a bug in the arm64 tool installer that references the x64 version.
Late to the party, but I had the same issue on a M1 Macbook. Strangely enough, the following steps worked for me:
sudo dotnet tool uninstall dotnet-ef --global
dotnet tool update --global dotnet-ef
I was quite desperate with this bug until I found https://developercommunity.visualstudio.com/t/libhostfxrdylib-not-signed/909971.
I could resolve the libhostfxr.dylib error when calling dotnet ef command. By simply fully updating my Visual Studio for Mac.
Problem: Some code signing issue with this file and macOS just moves it to some kind of quarantine (as far as I understood)
Solution: Open Visual Studio for Mac and install all the updates.
I first found the link on developercommunity and then thought it might just work and it really did.
If this helped you, you too might just be hooked to Jetbrains Rider. But installing dotnet via Rider does not fix the problem and also installing this extension https://plugins.jetbrains.com/plugin/18147-entity-framework-core-ui did NOT resolve it.
If you don't mind having Visual Studio for Mac also on your machine it's worth a shot.
I'm trying to use EntityFrameworkCore#3.1. In order to do this at this point I already have:
- Installed Visual Studio 2019 Preview
- Installed the .NET Core 3.1 Runtime
- Installed the .NET Core 3.1 SDK
Now I still can't run the command dotnet ef migrations add xxx. It's saying that I have to update the dotnet tools. So I run the following command in an administrator powershell:
PS C:\WINDOWS\system32> dotnet tool update --global dotnet-ef
Tool 'dotnet-ef' was reinstalled with the latest stable version (version '3.0.0')
Okay, not including the preview versions. So I try to specify the version explicitly:
PS C:\WINDOWS\system32> dotnet tool update --global dotnet-ef --version="3.1.0-preview1.19506.2"
error NU1202: Package dotnet-ef 3.1.0-preview1.19506.2 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any. Package dotnet-ef 3.1.0-preview1.19506.2 supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1)
Tool 'dotnet-ef' failed to update due to the following:
The tool package could not be restored.
Tool 'dotnet-ef' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
Now it's saying that a .NET Core 3.1 tool is not compatible with the .NET Core 3.1 runtime.
However, if I do a simple version check:
PS C:\WINDOWS\system32> dotnet --version
3.1.100-preview1-014459
PS C:\WINDOWS\system32> dotnet ef --version
Entity Framework Core .NET Command-line Tools
3.0.0
I can see that the EntityFrameworkCore.Tools is still at version 3.0.0 instead of 3.1.0 (which tools version is installed in my project).
Am I still missing something or is this a bug?
Thanks to #lars-haupt-hansen for pointing me to the bug, I followed the trail to the PR which shows it was merged into "aspnet:release/3.1". The latest 3.1 is still a preview (preview3) [edit: it's out of preview]. You can find and download the latest SDK here.
To use it in Visual Studio projects, you have to
install the SDK from the above link;
go to Tools > Options > Environment > Preview Features and enable "Use previews of the .NET Core SDK"; (not required for 3.1 anymore)
restart VS (not required for 3.1 anymore)
Go to each project properties, and then you can choose the Target Framework .NET Core 3.1
Then to install EF Core via the command line, run dotnet tool install --global dotnet-ef from your project directory.
dotnet tool install -g dotnet-ef --version 3.0.0-preview4.19216.3
dotnet tool install --global dotnet-ef --version 3.0.0-preview8.19405.11
Someone has asked the exact question I need on this page.
However, as I am new, my rep will not allow me to comment yet! So I have had to create a new question.
A guy in the question linked above suggests to "Type cordova platform add ios;". So there I suppose is where my question is different.
When I type Cordova in cmd prompt, I get a message saying "cordova is not recognized as an internal or external command, operable program or batch file."
Update: Please note, I have followed these steps: http://cordova.apache.org/docs/en/7.x/guide/cli/ And I am able to run the npm commands in CLI. I was hoping to simply update my ios version only.
I have also looked up PATH but I have no idea where to start, problem is, people suggest that I shouldn't need to adjust PATH as running the CLI commands to install the Cordova CLI should just allow me to use it?
So to summarize:
I downloaded the node.js and installed it
I typed this into cmd "npm install -g cordova" which installed
I type "cordova" and get my "cordova is not recognized as an internal or external command" message above
My aim is to upgrade my cordova-ios 4.2.0 to cordova-ios 4.3.0 to fix my main error of "remote build requires your projects to use cordova-ios 4.3.0 or greater with XCode 8.3"
Update 2 9th oct 2017:
I have given up for now with the above, to work around this i installed Node.js 8.6.0 then updated cordova using npm... im now facing some more issues that I am again stuck on and will create a new question.
Hopefully in the meantime, someone can answer this question and i can try again.
I suspect my issues could be relating to the fact i installed VS 2017 and used all the built in nuget packages (for cordova and node.js) and they are conflicting with the manual way in some way (i suspect that, as running the "cordova" command on my other PC worked fine!)
We recently decided to use Android Studio's CMake support as a part of our development, and as far as compiling and building is concerned everything works fine for the development team.
As a part of our validation efforts we are also running Jenkins for continuous testing, and that's where the problems are starting. The machine running Jenkins does not have Android Studio installed, nor it has an UI. As such it only possesses the android NDK and SDK. However, when running tests, the following error occurs :
Failed to find CMake.
Install from Android Studio under File/Settings/Appearance & Behavior/System Settings/Android SDK/SDK Tools/CMake.
Expected CMake executable at /home/vagrant/android-sdk-linux/cmake/bin/cmake.
The problem now is that there is no way to install CMake like suggested ! The machine does not have any UI to run Android Studio, and the command line tools feature no option to install CMake. And creating sym-links isn't the solution either, as CMake isn't the only thing it's looking for.
How am I supposed to make my project work on the machine ? CMake is running perfectly (as it was already used as part of the tests) so the problem is only coming from Gradle looking only in the SDK directory for it...
The problem now is that there is no way to install CMake like suggested
Actually it is not! Instead of using android list sdk command for installing sdk packages you should use new command line tool: sdk-manager.
Ndk, cmake are available for installing through this new android sdk tool.
you need to install manually cmake on your system unix:
go to your android sdk directory ${ANDROID_HOME} and create new cmake folder with:
wget "https://dl.google.com/android/repository/cmake-3.6.3155560-linux-x86_64.zip"
unzip -q cmake-3.6.3155560-linux-x86_64.zip -d ${ANDROID_HOME}/cmake
add to PATH ENV ${PATH}:${ANDROID_HOME}/cmake/bin
I am getting a bit confused here.
I have an MVC 5 project, I want to use the npm for managing my javascript packages.
I installed npm from nuget and here i am stuck, I cant find the commandline console window or anything like that.
All the info i see online is about node projects.
Can someone direct me to a relevant tutorial.
Using visual studio 2013, MVC 5.
Well regardless of the project, if you want to use npm on Windows, this is what you need:
Download and install Node (you might need a restart).
Make sure that node is installed by opening a command prompt and running node -v (should print a version number).
Run npm -v and see if it's installed (should be).
Now in the context of an ASP.NET MVC project. The newer versions of Visual Studio (I believe 2015) support npm - you can just open the package.json and add dependencies (it will download them behind the scenes). In case you're using an old version, you can simply open a command prompt, navigate to your project and use npm install from there.