Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Mono on Ubuntu 18.04

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to install Mono on Ubuntu 18.04". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn" how to install Mono on Ubuntu 18.04".

Mono is a platform for developing and running cross-platform applications. Mono is based on the ECMA / ISO standard and is a free and open source implementation of the Microsoft .NET Framework.

precondition

These instructions assume that you are logged in as root or as a user with sudo privileges.

Install Mono on Ubuntu

The easiest and recommended way to install Mono on Ubuntu 18.04 is to install it from Mono's repository. This is a relatively simple process that only takes a few minutes.

First install the necessary software packages:

Sudo apt updatesudo apt install dirmngr gnupg apt-transport-https ca-certificates

Use the following command to import the GPG key for the repository:

Sudo apt-key adv-keyserver hkp://keyserver.ubuntu.com:80-recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

The output should look like this:

Gpg: key A6A19B38D3D831EF: public key "Xamarin Public Jenkins (auto-signing)" importedgpg: Total number processed: 1gpg: imported: 1

Add the Mono repository to the list of system sources by running the following command:

Sudo sh-c 'echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" > / etc/apt/sources.list.d/mono-official-stable.list'

Once the APT repository is enabled, update the package list and match the installation Mono:

Sudo apt updatesudo apt install mono-complete

The mono-complete is a meta-package to install the mono runtime, development tools, and all libraries.

Verify the installation by typing the following command, which prints the Mono version:

Mono-version

At the time of this writing, the latest stable version of Mono is 6.6.0 Stable (6.6.0.161).

Mono JIT compiler version 6.6.0.161 (tarball Tue Dec 10 10:36:32 UTC 2019) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. Www.mono-project.com TLS: _ _ thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug Interpreter: yes LLVM: yes Suspend: hybrid GC: sgen (concurrent by default)

That's it, you've successfully installed Mono on Ubuntu, and then you can start using it.

Getting started with Mono

To verify that all the settings are correct, we will build a Hello World program that will print the classic "hello world" message.

Open a text editor and create a hello.cs file that contains the following:

Hello.cs

Using System;public class HelloWorld {public static void Main (string [] args) {Console.WriteLine ("HelloWorld!");}}

Use the csc compiler to generate the program:

Csc hello.cs

The above command builds an executable file called hello.exe.

Run the executable file using the following command:

Mono hello.exe

The output should look like this:

Hello, World

If you just want to execute the program by typing the program name, you need to set an executable flag:

Chmod + x hello.exe

You can now run the file by hello.exe by typing:

. / hello.exe Thank you for your reading, the above is the content of "how to install Mono on Ubuntu 18.04". After the study of this article, I believe you have a deeper understanding of how to install Mono on Ubuntu 18.04. the specific use situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report