ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!

Cracked.to | Best Cracking Forum Around | Free Premium Accounts




 393

[sunjester tuts] Using C# (.NET code/apps) on Linux

by sunjester - 1 year ago
This post is by a banned member (sunjester) - Unhide
sunjester  
Registered
0
Rep
42
Likes
Posts: 19
Threads: 12
Joined: Mar 2019
Vouches: 0
Credits: 5.510
Introduction
All of my tutorials are written, tested, and meant to be used on Linux. I am using Ubuntu xenial (currently 16.04). You can use any debian distro and follow any of my tutorials. I will not pander to the Windows kiddies, don't ask.
 
Directions
First, let's check what version you have, you can use the lsb_release command.

Code:
lsb_release -a
 
18.04
Code:
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-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
 
16.04
Code:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt install apt-transport-https ca-certificates
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
 
14.04
Code:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt install apt-transport-https ca-certificates
echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
 
Next, install Mono
Code:
sudo apt install mono-devel
Now we can compile and then run the C# code below, that i've saved in a file named hello.cs
Code:
using System;
 
public class HelloWorld
{
    static public void Main ()
    {
        Console.WriteLine ("Hello World");
    }
}
using the csc to compile
csc hello.cs
 
and using mono to run the .net executable
mono hello.exe
 
WinForms
You can compile the winforms applications using the following argument
Code:
-r:System.Windows.Forms.dll
Gtk# Forms

Code:
-pkg:gtk-sharp-2.0
This post is by a banned member (nsarat) - Unhide
nsarat  
Registered
0
Rep
5
Likes
Posts: 4
Threads: 0
Joined: Mar 2019
Vouches: 0
Credits: -4
#2
what is gtksharp
This post is by a banned member (socalgurl) - Unhide
socalgurl  
Registered
0
Rep
10
Likes
Posts: 10
Threads: 0
Joined: Mar 2019
Vouches: 0
Credits: 0
#3
thanks for this

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)