diff --git a/Readme.md b/Readme.md index 402d96e..51512ad 100644 --- a/Readme.md +++ b/Readme.md @@ -1,20 +1,28 @@ # Mono + GTK# + Glade — WSL Setup Guide ## Table of Contents -- [1. Prerequisites](#1-prerequisites) -- [2. Install Mono](#2-install-mono) -- [3. Install GTK# (GTK# 3.0, for Ubuntu 24.04)](#3-install-gtk-gtk-30-for-ubuntu-2404) -- [4. Install Glade (visual UI designer)](#4-install-glade-visual-ui-designer) -- [5. Optional: libgdiplus (only if using System.Drawing)](#5-optional-libgdiplus-only-if-using-systemdrawing) -- [6. Compiling & Running](#6-compiling--running) -- [7. Minimal Working Examples](#7-minimal-working-examples) -- [8. Custom Output Names, Targets & Exporting DLLs](#8-custom-output-names-targets--exporting-dlls) -- [9. Common Errors & Fixes](#9-common-errors--fixes) -- [10. Notes on Alternatives](#10-notes-on-alternatives) +- [Mono](#mono) + - [1. Prerequisites](#1-prerequisites) + - [2. Install Mono](#2-install-mono) + - [3. Install GTK# (GTK# 3.0, for Ubuntu 24.04)](#3-install-gtk-gtk-30-for-ubuntu-2404) + - [4. Install Glade (visual UI designer)](#4-install-glade-visual-ui-designer) + - [5. Optional: libgdiplus (only if using System.Drawing)](#5-optional-libgdiplus-only-if-using-systemdrawing) + - [6. Compiling & Running](#6-compiling--running) + - [7. Minimal Working Examples](#7-minimal-working-examples) + - [8. Custom Output Names, Targets & Exporting DLLs](#8-custom-output-names-targets--exporting-dlls) + - [9. Common Errors & Fixes](#9-common-errors--fixes) + - [10. Notes on Alternatives](#10-notes-on-alternatives) +- [OS](#os) + - [Workflow](#workflow) + - [OS images checked](#os-images-checked) + - [OS images to check](#os-images-to-check) + --- -## 1. Prerequisites +## Mono + +### 1. Prerequisites - Windows 11 (or updated Windows 10) with WSL2 and **WSLg** enabled for GUI support - Ubuntu 24.04 (noble) or similar WSL distro @@ -26,7 +34,7 @@ --- -## 2. Install Mono +### 2. Install Mono ```bash sudo apt update @@ -41,7 +49,7 @@ --- -## 3. Install GTK# (GTK# 3.0, for Ubuntu 24.04) +### 3. Install GTK# (GTK# 3.0, for Ubuntu 24.04) > Note: `gtk-sharp2` is **not available** on Ubuntu 24.04 (noble). Use `gtk-sharp3` instead. @@ -59,7 +67,7 @@ gtk-sharp-3.0 Gtk - Gtk --- -## 4. Install Glade (visual UI designer) +### 4. Install Glade (visual UI designer) ```bash sudo apt install glade @@ -73,7 +81,7 @@ --- -## 5. Optional: libgdiplus (only if using System.Drawing) +### 5. Optional: libgdiplus (only if using System.Drawing) Only needed if your code uses `System.Drawing.Bitmap`, `Graphics`, etc. (not required for plain GTK#/Glade apps): @@ -83,21 +91,21 @@ --- -## 6. Compiling & Running +### 6. Compiling & Running -### Plain console C# program +#### Plain console C# program ```bash mcs myprogram.cs mono myprogram.exe ``` -### GTK# 3.0 program (no Glade) +#### GTK# 3.0 program (no Glade) ```bash mcs -pkg:gtk-sharp-3.0 myapp.cs mono myapp.exe ``` -### GTK# 3.0 program using a Glade file +#### GTK# 3.0 program using a Glade file ```bash mcs -pkg:gtk-sharp-3.0 -pkg:glade-sharp-3.0 myapp.cs mono myapp.exe @@ -106,9 +114,9 @@ --- -## 7. Minimal Working Examples +### 7. Minimal Working Examples -### Hello World (console) +#### Hello World (console) ```csharp using System; @@ -123,7 +131,7 @@ mono hello.exe ``` -### Hello World (GTK# window, no Glade) +#### Hello World (GTK# window, no Glade) ```csharp using System; using Gtk; @@ -149,7 +157,7 @@ mono gtkcheck.exe ``` -### Loading a UI built in Glade +#### Loading a UI built in Glade ```csharp using System; using Gtk; @@ -175,11 +183,11 @@ --- -## 8. Custom Output Names, Targets & Exporting DLLs +### 8. Custom Output Names, Targets & Exporting DLLs By default, `mcs file.cs` names the output after the source file (`file.exe`). You can control this with `-out:` and change what kind of binary is produced with `-target:`. -### 8.1 Custom output name +#### 8.1 Custom output name ```bash mcs -pkg:gtk-sharp-3.0 Program.cs -out:MyCustomApp.exe ``` @@ -188,7 +196,7 @@ mono MyCustomApp.exe ``` -### 8.2 `-target` options +#### 8.2 `-target` options | Target | Produces | Notes | |---|---|---| | `exe` (default) | Console executable | Shows a console window when run on Windows | @@ -202,7 +210,7 @@ ``` This produces `programwin.exe`, which on Windows will run without popping up a console window alongside your GTK window. -### 8.3 Exporting a DLL +#### 8.3 Exporting a DLL If you want to package reusable code (helper classes, business logic, etc.) as a library instead of a standalone app: @@ -213,7 +221,7 @@ - No `Main()` method is required in a `library` target (though it's fine if one class in your project has one — it just won't be used as an entry point for the DLL itself). - This creates `MyLibrary.dll`, a Mono/.NET assembly that other C# programs can reference. -### 8.4 Using a DLL in another program +#### 8.4 Using a DLL in another program Suppose `MyLibrary.dll` contains: ```csharp @@ -253,7 +261,7 @@ mono ConsumerApp.exe ``` -### 8.5 Combining `-target:library` with GTK# packages +#### 8.5 Combining `-target:library` with GTK# packages If your DLL itself uses GTK# types (e.g., a shared custom widget), include the package flag when building the library too: ```bash mcs -target:library -pkg:gtk-sharp-3.0 MyGtkWidgets.cs -out:MyGtkWidgets.dll @@ -263,7 +271,7 @@ mcs -pkg:gtk-sharp-3.0 ConsumerApp.cs -r:MyGtkWidgets.dll -out:ConsumerApp.exe ``` -### 8.6 Quick reference +#### 8.6 Quick reference ```bash # Console exe, custom name mcs Program.cs -out:myapp.exe @@ -278,7 +286,7 @@ mcs Consumer.cs -r:MyLibrary.dll -out:Consumer.exe ``` -### 8.7 Running the compiled .exe on Windows (outside WSL) +#### 8.7 Running the compiled .exe on Windows (outside WSL) Compiling in WSL produces a `.exe` that targets the .NET/Mono runtime — it is **not** a native Windows binary, and it will not run on Windows by itself. Two things are needed: @@ -308,7 +316,7 @@ --- -## 9. Common Errors & Fixes +### 9. Common Errors & Fixes | Error | Cause | Fix | |---|---|---| @@ -322,7 +330,7 @@ --- -## 10. Notes on Alternatives +### 10. Notes on Alternatives GTK# is a legacy, lightly-maintained binding. For new projects, consider: - **Avalonia UI** — modern, XAML-based, cross-platform, actively maintained @@ -353,4 +361,22 @@ to run note: same for all cases - mono NAME_OF_THE_FILE.exe \ No newline at end of file + mono NAME_OF_THE_FILE.exe + +## OS + +To test the application/setup across different Linux distributions, I used **Ventoy** to create a multiboot USB drive. Ventoy lets you copy multiple ISO files onto a single USB stick and choose which one to boot at startup, without needing to reformat or re-flash the drive for each OS. + +### Workflow +1. Install Ventoy on the target USB drive. +2. Copy the desired `.iso` files directly onto the Ventoy partition (no extraction needed). +3. Boot from the USB, select the ISO from the Ventoy boot menu, and test the OS live or install it. + +### OS images checked +- Fedora-Workstation-Live-44-1.7.x86_64 +- lubuntu-26.04-desktop-amd64 +- xubuntu-25.10-desktop-amd64 + +### OS images to check +- antiX-26_x64-full +- xubuntu-26.04-minimal-amd64 \ No newline at end of file