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?
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.
I'm trying to setup a backend on my local computer I have installed the v6 dotnet everything is installed but when i run dotnet run
I get this error
The command could not be loaded, possibly because:
* You intended to execute a .NET application:
The application 'run' does not exist.
* You intended to execute a .NET SDK command:
No .NET SDKs were found.
Download a .NET SDK:
https://aka.ms/dotnet-download
Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
dotnet --info
PS C:\Users\Az\bazaar-online\Server\Src\BazaarOnline.API> dotnet --info
global.json file:
Not found
Host:
Version: 6.0.7
Architecture: x86
Commit: 0ec02c8c96
.NET SDKs installed:
No SDKs were found.
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.7 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.7 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
I searched a lot but i didn't find anything useful.
reinstalled everything tried v3 but didn't fix anything
I have installed these files.
dotnet-hosting-6.0.7-win
dotnet-runtime-6.0.7-win-x64
dotnet-sdk-6.0.302-win-x64
Ok This fixed the problem for me
I went to the C:\Program Files (x86)\dotnet
and deleted everthing in the folder
and than vscode recognized the dotnet sdk.
The command could not be loaded, possibly because:
You intended to execute a .NET application:
The application 'myapp.dll' does not exist.
You intended to execute a .NET SDK command:
No .NET SDKs were found.
Download a .NET SDK:
https://aka.ms/dotnet-download
Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
use this commands
1.sudo apt remove dotnet*
2.sudo apt remove aspnetcore*
3.sudo rm /etc/apt/sources.list.d/microsoft-prod.list
4.sudo apt update
5.sudo apt install dotnet-sdk-6.0
I just had this same issue when I wanted to install a new template dotnet new -i "Falco.Template::*". Simply reinstalling the dotnet 6 SDK solved it for me.
I'm new to Linux and want to code some C# on Linux for school. The problem is I don't know how to install C#. I already read the instructions from Microsoft, but I couldn't get it to work.
'arm64' is the Debian port name for the 64-bit Armv8 architecture, referred to as 'aarch64' in upstream toolchains. The snapd daemon and tooling that enables snap packages is available for arm64 architecture in Debian.
To install snapd:
sudo apt update
sudo apt install snapd
Either log out and back in again or restart your system to ensure that snap's paths are updated correctly. After this install the core snap in order to get the latest snapd:
sudo snap install core
C# is open source and cross platform now that Microsoft has released a version of .NET Core. To install .NET Core in Debian open the terminal and type:
sudo snap install dotnet-sdk --classic
sudo snap alias dotnet-sdk.dotnet dotnet # to run dotnet-sdk type dotnet
The instructions from Microsoft seem to assume that you are running Visual Studio Code on Windows, so they frequently don't work at all on Linux. The following instructions were tested on a Debian-based system (Ubuntu 20.04). I ran a few C# console apps for test purposes, but let's start with a simple one-line C# console app. Run these commands to build and run an example C# Hello World console app from the terminal:
cd ~
mkdir C#_Projects
cd C#_Projects
mkdir HelloWorld
cd HelloWorld
dotnet new console
dotnet build --output ./build_output
dotnet ./build_output/HelloWorld.dll
Results of dotnet ./build_output/HelloWorld.dll
Hello, World!
I know that .net core is available for Linux, I can build in VS 2019 and publish for Linux, including self-contained package. So that is all beautiful and there would be no issue, unless... We have a customer using RHEL 7.1 little-endian on Power8 CPU where there is Mono 6.8. No dotnet on any PowerPC platform, as far we can see (havent got access to test machine yet). So we need to investigate if the project written in .NET Core 3.1 could be ported to Mono.
As first step to test the porting path, I create simple command line app that basically prints "Hello" and exits. Then I build Any CPU and install Mono 6.12 on Windows, try to run:
> mono Simple.Dll
Hello!
So it worked also with Mono on Windows, and of course with dotnet. Now, build and deploy using RID linux-x64 to the Ubuntu 20.04 running on Windows subsystem for Linux.
Having dotnet installed for Ubuntu, it works fine, both when I use 'Portable' or linux-x64 in deploy:
> dotnet Simple.dll
Hello!
Then I install mono:
> sudo apt install mono-runtime
> ...
> mono --version
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)
> dotnet --version
3.1.402
The next obvious step:
> mono Simple.dll
"The entry point method could not be loaded due to Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies."
The same (with Version=4.2.1.0) error happens when I try to downgrade to .NET 2.1. So this is where my understanding of CLI world reaches its limit. Am I missing part of runtime libraries on Ubuntu?
The dotnet publish generated binaries are strictly for .NET Core, and only supported on a few platforms,
https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-supported-os.md
If you do need to support more platforms, then
Port .NET Core runtime to that platform. You can see that there are community efforts out there (like the FreeBSD port).
Share the source code between a .NET Core project and a .NET Framework/Mono project, so that you can generate Mono compatible binaries in parallel.
I created a "Hello World" app and now I'm trying to run it on a Raspbarry Pi.
When I select "Self-containt" in publish, all files are copied to the Raspberry and I can execut the "Hello World" app.
But when I select "Framework-dependant" and publish the app to the Raspberry, I get an error message when I want to run it:
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
- No frameworks were found.
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.NETCore.App&framework_version=3.1.0&arch=arm&rid=raspbian.10-arm
But when I check the installed versions:
pi#raspberrypi:~/Desktop/ConsoleAppRaspberryPi1 $ dotnet --list-sdks
3.1.302 [/home/pi/dotnet/sdk]
[1] Exit 127 - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App
[2]- Done framework_version=3.1.0
[3]+ Done arch=arm
pi#raspberrypi:~/Desktop/ConsoleAppRaspberryPi1 $ dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.6 [/home/pi/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.6 [/home/pi/dotnet/shared/Microsoft.NETCore.App]
So I have a 3.1.0 SDK and a 3.1.6 Microsoft.NETCore.App runtime.
In Visual Studio dotnet core 3.1 is selected as target framework.
So why I'm not able to run it on the raspberry. Is a dotnet-core app targeting 3.1 not capable to run un a 3.1.6 runtime?
Can I compile it to run on core 3.1.6? Or should core 3.1 be able to run on runtime 3.1.6? 3.1 is the newest version I can find in Visual Studio installer.
Installing the dotnet runtime to /usr/share/dotnet solved the problem for me. Now it's possible to publish as Framework-dependant.