Create a new .NET Core project, class library type
Rename the Class1.cs file to Program.cs
Install 2 packages into the project. Xamarin.Forms (5.0.0.2578) and Xamarin.Forms.Platform.GTK (5.0.0.2578).
Insert the following code:
using Xamarin.Forms;
using Xamarin.Forms.Platform.GTK;
namespace Example.GTK
{
class MainClass
{
[STAThread]
public static void Main(string[] args)
{
Gtk.Application.Init();
Forms.Init();
var app = new App();
var window = new FormsWindow();
window.LoadApplication(app);
window.SetApplicationTitle("Game of Life");
window.Show();
Gtk.Application.Run();
}
}
}
### Expected behaviour.
Everything will start up and the window from the manual will appear.
### Actual behaviour
Build errors
### Basic information
- Version with issue: 5.0.0.2578
- Last known good version: ?
- Platform Target frameworks: <!-- All that apply -->
- GTK: 5.0.0.2578
- NuGet packages: Xamarin.Forms (5.0.0.2578), Xamarin.Forms.Platform.GTK (5.0.0.2578)
- Affected devices: ?
### Environment
user@KirMozorPC
OS: Arch Linux x86_64
Kernel: 6.3.6-arch1-1
Uptime: 1 hour, 34 mins
Packages: 1032 (pacman)
Shell: fish 3.6.1
Resolution: 1920x1080
DE: GNOME 44.2
WM: Mutter
WM Theme: Adwaita
Theme: Dracula [GTK2/3]
Icons: Dracula [GTK2/3]
Terminal: alacrity
CPU: Intel i5-2500S (4) @ 3.700GHz
GPU: NVIDIA GeForce GT 730
Memory: 6169MiB / 7905MiB
Looks like you might have not added (the right version of) the GTK libraries. Unfortunately the GTK backend is not officially supported by Microsoft and I know very little about it. I hope you can get it fixed!
Description
I'm trying to make my program in GTK using Xamarin, but I've already started having problems, nothing works (I used this tutorial: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/gtk?tabs=windows).
Steps to play
namespace Example.GTK { class MainClass { [STAThread] public static void Main(string[] args) { Gtk.Application.Init(); Forms.Init(); var app = new App(); var window = new FormsWindow(); window.LoadApplication(app); window.SetApplicationTitle("Game of Life"); window.Show(); Gtk.Application.Run(); } } }
user@KirMozorPC
OS: Arch Linux x86_64 Kernel: 6.3.6-arch1-1 Uptime: 1 hour, 34 mins Packages: 1032 (pacman) Shell: fish 3.6.1 Resolution: 1920x1080 DE: GNOME 44.2 WM: Mutter WM Theme: Adwaita Theme: Dracula [GTK2/3] Icons: Dracula [GTK2/3] Terminal: alacrity CPU: Intel i5-2500S (4) @ 3.700GHz GPU: NVIDIA GeForce GT 730 Memory: 6169MiB / 7905MiB