My setup:
-- Linux --
Distributor ID: Linuxmint
Description: Linux Mint 21
Release: 21
Codename: vanessa
-- Dotnet SDK--
6.0.402 [/home/gilmar/.dotnet/sdk]
-- Dotnet Runtime --
Microsoft.AspNetCore.App 6.0.10 [/home/gilmar/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.10 [/home/gilmar/.dotnet/shared/Microsoft.NETCore.App]
-- Dotnet Tools --
ID do Pacote Versão Comandos
---------------------------------------
dotnet-ef 6.0.10 dotnet-ef
I have trouble when I try to run the command dotnet ef. When I do it, returns the message below:
You must install .NET to run this application.
App: /home/gilmar/.dotnet/tools/dotnet-ef
Architecture: x64
App host version: 6.0.10
.NET location: Not found
Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=linuxmint.21-x64&apphost_version=6.0.10
I modified my file .bashrc adding the lines below:
export PATH="$PATH:$HOME/.dotnet"
export PATH="$PATH:$HOME/.dotnet/tools/"
The folders in my directory:
gilmar#hp ~ $ whereis dotnet
dotnet: /home/gilmar/.dotnet/dotnet
gilmar#hp ~ $ whereis dotnet-ef
dotnet-ef: /home/gilmar/.dotnet/tools/dotnet-ef
I can run normally dotnet restore, dotnet new, dotnet build, etc, but I can't run dotnet ef
I tried:
dotnet ef
dotnet-ef
dotnet dotnet-ef
dotnet dotnet ef
I installed dotnet using the script from Microsoft at https://dot.net/v1/dotnet-install.sh
Anyone can help me?
Thanks.
I had the same problem, I tried the same commandes and the solution was to redelete everything and reinstall it then don't forget the :
export PATH="$PATH:$HOME/.dotnet" export
PATH="$PATH:$HOME/.dotnet/tools/"
that solved the problem for me !
Related
I have a new Ubuntu 20.04.2 LTS install.
I have installed:
Visual Studio Code 1.73.0
.net 3.1 using this link here https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#install-the-sdk
mono 6.12.0.182
For my project, I need to use .net 3.1. To do this in visual studio code, I have to use Mono (from what I read).
When I try to run the project, it does not show .net 3.1 or mono in the select box.
Anyone know how to fix this so VS code will allow me to use .net 3.1 or mono to run my .net 3.1 app?
one#work ...IS.custom-forms/frontend/widgets (core/EFB-1931/address-widget)
% which dotnet
/usr/bin/dotnet
one#work ...IS.custom-forms/frontend/widgets (core/EFB-1931/address-widget)
% dotnet --version
3.1.424
I verified the following workflow on a fresh VM with Ubuntu 20.04 LTS and with VS Code installed from Ubuntu Software (GUI).
Installing the .NET 3.1 SDK
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-3.1
Sanity check
dotnet --info
Output
.NET Core SDK (reflecting any global.json): Version: 3.1.425
Commit: ca553b8af8
Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS
Platform: Linux RID: ubuntu.20.04-x64 Base Path:
/usr/share/dotnet/sdk/3.1.425/
Host (useful for support): Version: 3.1.31 Commit: 0e404aa9b8
.NET Core SDKs installed:
3.1.425 [/usr/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.31
[/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.31
[/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Installing Mono
Ref https://www.mono-project.com/download/stable/.
sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-devel
Creating test app and launching VS Code
dotnet new mvc -n "TestProject" -au None
cd TestProject
code .
From the Extensions tab, install: C# for Visual Studio Code (powered by OmniSharp).
Go to settings (Ctrl+,). Search for "use modern net", uncheck the checkbox.
Open a terminal window (Ctrl+`) and close VS Code.
Open project again (from Ubuntu terminal):
code .
You should see the following output in the terminal window.
You can either select "Yes" on the notification or click "Generate C# Assets for Build and Debug" from the debug tab.
Select ".NET 5+ and .NET core" from the debugger dropdown.
Open Startup.cs from the Explorer tab and add a breakpoint.
Hit F5.
Q&A
When I try to run the project, it does not show .net 3.1 or mono in the select box.
Anyone know how to fix this so VS code will allow me to use .net 3.1 or mono to run my .net 3.1 app?
.NET 3.1 is included under the .NET core part of ".NET 5+ and .NET core". Chances are the C# dependencies and/or the package for Mono (ref screenshot) were not set up correctly. If you follow the workflow on a fresh install, you should be able to set the dependencies straight before attempting your actual project.
My structure of folders is
BulkyBook
/ BulkyBook.DataAccess
/ BulkyBook.Models
/ BulkyBook.Utility
/ BulkyBookWeb
Inside BulkyBook.DataAccess contains my ApplicationDbContext, my migrations and also the repository. And inside BulkyBook.Models contains my representation of the model.
I have a Macbook Pro M1 and when I try to run this command to create my database at my container.
dotnet ef update database --project ~/Documents/learning/bulky/BulkyBook.Models/BulkyBook.Models.csproj
This message appeared on terminal
Build started...
Build succeeded.
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0' (arm64) was not found.
- The following frameworks were found:
6.0.6 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Before all I ran this command on terminal
dotnet tool install dotnet-ef --global -a arm64
Seemingly your project targets NETCore.App version 2.0.0. Download and install Microsoft.NETCore.App, version 2.0.0 runtime and try again.
If it doesn't work, setting your web project as startup project may resolve the issue.
I have recently got a Mac M1, I have to build a Microservice based Web API application on Asp.net Core using EF & SQL Server.
I added EntityFrameworkCore(5.0.11) through NuGet Package successfully. The sdk & runtime installed details on my Mac is:
.NET SDKs installed:
- 6.0.101
.NET runtimes installed:
- Microsoft.AspNetCore.App 6.0.1
- Microsoft.NETCore.App 6.0.1
Firstly , I was not able to install SQL Server 2019 on Mac but after searching I found a solution for that by installing SQL Edge on Docker & connecting to Azure Data Studio and it's working fine.
Now the problem is I am not able to run EFcore migration add initial, Update Database through Entity Framework. I searched everywhere but whenever I am executing these command, I am getting following error:
Build started... Build succeeded. It was not possible to find any
compatible framework version The framework 'Microsoft.AspNetCore.App',
version '3.1.0' (arm64) was not found.
- The following frameworks were found: 6.0.1
You can resolve the problem by installing the specified framework
and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=arm64&rid=osx.12-arm64.
I did install the above framework but that is x64. And still EF command are not working and I am not able to update the database.
Is there any solution for this? Does EFCore work on Mac M1 machines?
The reason is that ef tool is not able to find the correct arch for now.
A workaround is to force ef tool to use the latest runtime found on your machine.
export DOTNET_ROLL_FORWARD=LatestMajor
export the above env var and run dotnet ef xxx again.
Update
This fixes the problem permanently:
dotnet tool uninstall dotnet-ef -g
dotnet tool install dotnet-ef -a arm64 -g
You can also install 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 with the .Net 5/6 arm64.
There's a bug in the arm64 version installer that references the x64 version of EF Core.
Try to install proper SDK version manually from this link.
You need to use the sdk version for your cli,.NET 5 and below installs in a different directory and from your output looks like you cli points to .NET 6. You should install the ef tools locally like so
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local dotnet-ef --version 5.0.15
then,
/usr/local/share/dotnet/x64/dotnet ef migrations add initialCreate -s ../API -o Migrations
You can shorten the path by using this article https://dev.to/smiththe_4th/use-multiple-net-sdk-cli-commands-on-mac-m1-64j
I have an Atmel dev kit, with an ARM Cortex-A5 processor in it. I have an application written for dotnet core that I need to run on it. I have successfully got Ubuntu 16.04 running on it (which I set up from these instructions).
As a comparison point, I've tried setting up and running a "hello world" dotnet example on a Raspberry Pi - this works fine. But, using the same steps on the Atmel board it always crashes with Illegal Instruction, and no further information.
I have downloaded the armhf binary for dotnet from the download page: https://github.com/dotnet/core-setup/, and have tried both the 2.0.5 stable release and the 2.1.0 preview, both give the same result.
I've made the simple example from the Microsoft website, then prepared it for Linux-ARM on my host machine with dotnet publish -r linux-arm. When I move the output to the dev board and try to run it, I get this:
$ dotnet --info
Host (useful for support):
Version: 2.1.0-preview2-26226-02
Commit: 40177995a6
.NET Core SDKs installed:
No SDKs were found.
The.NET Core runtimes installed:
Microsoft.NETCore.App 2.1.0-preview2-26226-02 [/home/ubuntu/dotnet/shared]
$ dotnet myApp.dll
Illegal instruction
Is there something I need to do for dotnet core on this ARM device? Or is this a bug that I should file?
I have install and repair dotnet sdk 1.1 and dotnet sdk 2.0 preview with visual studio preview,
Now when I type any command CLI, I have no result.
PS C:\Codes\Anna\src\Web\test> dotnet new
PS C:\Codes\Anna\src\Web\test>
I have test to run with administrator but this not working.
Or with this command
PS C:\Codes\Anna\src\Web\test> dotnet --info
PS C:\Codes\Anna\src\Web\test>
My path is :
PS C:\Windows\system32> (get-command dotnet).Path
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\dotnet.exe
The path is wrong. C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\dotnet.exe is only used to run compiled .Net Core 1.0 applications. You want to use C:\Program Files\dotnet\dotnet.exe, which will let you run the SDK commands, like dotnet new.
I don't know how did the wrong dotnet.exe get into your PATH. Are you sure you installed the SDK, and not just the runtime?
If you think it could be a bug in the installer, you might consider reporting it at the dotnet/core-setup repo.