How to install .NET Core on aarch64 architecture Debian - c#

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!

Related

dotnet Core on ARM Cortex-A5 - "Illegal Instruction"

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?

How to compile mono projects from command line on mac

I'm required to compile a C# project from the command line (not from within the IDE). It works just fine under linux (to be exact under Fedora and Ubuntu). I just install the mono-xbuild package and the build script is capable of executing the xbuild command. The problem is that there's no xbuild or mdtool inside the home-brew repositories and installing xamarin studio while building isn't the solution because it places the binary in different places depending on a whole range of conditions.
How do I get my build/install script to work out of the box under MacOSX?
You need to install .NET for macOS, then use a dotnet command to run compile and execute a .NET project.
Here are the commands to run a Hello World's app:
dotnet new console -o myApp
cd myApp
dotnet run
For Mono apps, you need to install Mono framework (available as a Mac .pkg file)
Consider also installing MSBuild (The Microsoft Build Engine). It requires OpenSSL (install via: brew install openssl). See: Building Testing and Debugging on .Net Core MSBuild.

How can mod_mono be configured to run .NET 4.5

I've been searching for days now, but still have not been able to find a way to get mod_mono to run .NET 4.5 web applications.
I've tried this and many other with no luck: Can XSP run ASP.NET 4.5?
Currently, I have a functioning Ubuntu 14.04 Server running mono 3.6.1 that is able to server .Net 4 applications:
Does anyone know how to configure mod_mono to run .NET 4.5?
My test site is a simple page with the following code, http://54.208.241.43/test.aspx.
<%=System.Environment.Version%>
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/tpokorra:/mono/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/mono-opt.list"
sudo apt-get update
sudo apt-get install mod_mono-opt
See these for more details
http://www.pokorra.de/2013/12/

Need to run C# on linux server

I used to be able to run vb.net apps using just this
apt-get install mono-runtime
apt-get install mono-vbnc
But I now need at least 2.8.0 to run a certain app that has already been compiled on windows. I have the option between the following OS's
ubuntu-12.04-x86
ubuntu-12.04-x86_64
ubuntu-12.10-x86
ubuntu-12.10-x86_64
centos-5-x86
centos-5-x86_64
centos-5-elastix_2.0.1_amd64
centos-6-x86
centos-6-x86_64
debian-6.0-x86
debian-6.0-i386-minimal
debian-6.0-x86_64
debian-6.0-amd64-minimal
debian-7-x86
debian-7.0-x86_64
I've tried the following on multiple versions of ubuntu.
#!/bin/bash
echo Checking for prerequisites. Please enter password if prompted.
sudo apt-get update
sudo apt-get install libpng3 libpng3-dev libtool libtiff4 libtiff4-dev libexif12 libexif-dev libgif4 libgif-dev libpango1.0-dev libatk1.0-dev bison automake autoconf make gcc gtk-sharp2 build-essential xorg-dev libfreetype6 libfontconfig libfontconfig-dev gettext libglib2.0-dev git mono-complete libjpeg-dev
echo Downloading latest build of mono...
git clone git://github.com/mono/mono.git
echo Navigating to mono install directory.
cd mono
echo Building mono from source...
./autogen.sh --prefix=/usr/local
make
echo Installing mono, running with sudo
sudo make install
echo Done!
Checking the mono version says it has worked, but I cant actually run the app due to this error:
The assembly mscorlib.dll was not found or could not be loaded. It should have been installed in the 'usr/lib/mono/4.5/mscorlib.dll'.
Which OS should I use and how can I install mono 2.8.0 or later to run a C# app which has been compiled on windows?
Build a clean Linux OS from ISO, such as Ubuntu 12.04.
Install the stable Mono release on it, such as apt-get install mono-complete. This is required to bootstrap the later steps.
Install Git and check out Mono source code, and switch to a stable branch (such as mono-3.2.8-branch).
Build that version of Mono from source and install it.
I don't recommend 3.4.0 or 3.6.0 branch at this moment, as new commits are still added to them in the past week (June 17 today). 3.2.8 is also the Mono version bundled in Ubuntu 14.04.
What you have been wrong is to check out the master branch. No no, that's not a stable release you should use.

How to run .NET 4.5 on XSP using Mono?

I have installed Mono 3 however when I run xsp or xsp4 it shows that I'm using .NET 4.0. I need to have .NET 4.5. Is it possible? Where can I configure it?
I've seen this page but I don't have any of those folders where I downloaded sources.
This is what it shows when I enter website by running xsp4:
Version Information: 3.2.7 (master/1eef047 C nov 28 18:16:30 EET 2013); ASP.NET Version: 4.0.30319.17020
How I installed Mono and XSP
Firstly I downloaded Lubuntu 13.10 32bit and launched it inside VirtualBox. Then did apt-get update and apt-get upgrade. After that rebooted the system.
Make sure all commands are executed as super user.
sudo -s
Got dependencies
apt-get install autoconf automake libtool g++ gettext libglib2.0-dev libpng12-dev libfontconfig1-dev mono-gmcs git
Downloaded sources of Mono and XSP
cd /opt
git clone git://github.com/mono/mono.git
git clone git://github.com/mono/xsp.git
Installed latest stable Mono from github
cd /opt/mono
./autogen.sh --prefix=/usr
make
make install
Installed latest stable XSP from github
cd /opt/xsp
./autogen.sh --prefix=/usr
make
make install
Tested that I have 4.0 running on XSP instead of 4.5
cd /home/pc/web
xsp4 # 4.0
xsp2 # 2.0
xsp # 2.0
My configuration
/usr/bin/xsp4 looks like it should use 4.5. Just like this answer suggested. Also, I don't have xsp4.exe in my /usr/lib/mono/4.0/ only in /usr/lib/mono/4.5/ so I cannot copy anything like suggested in that answer.
#!/bin/sh
exec /usr/bin/mono $MONO_OPTIONS "/usr/lib/mono/4.5/xsp4.exe" "$#"
You say "I don't have any of those folders where I downloaded sources" referring to /opt/mono/bin/xsp4. But you're confusing things, and I know it because you shared how you installed mono.
/opt/mono should not be the place where you clone the mono repository to compile it. You should clone it somewhere else like your home folder. I.e.: /home/username/code/mono.
/opt/mono is where usually people install a custom version of mono. The way they do it is passing this path to the --prefix argument. But you're passing /usr as the prefix argument! So then you're installing it to a different location compared to the SO answer that you point out.
Also, it is not recommended that you do ALL those operations as a superuser. You normally compile code without root privileges, and you only need sudo for the install phase. So don't do "sudo -s" before everything. Just compile, and when you're done, do sudo make install. This will also make you have binaries that are not owned by root.

Categories

Resources