Initial commit: .NET MAUI Linux Platform
Complete Linux platform implementation for .NET MAUI with:
- 35+ Skia-rendered controls (Button, Label, Entry, CarouselView, etc.)
- Platform services (Clipboard, FilePicker, Notifications, DragDrop, etc.)
- Accessibility support (AT-SPI2, High Contrast)
- HiDPI and Input Method support
- 216 unit tests
- CI/CD workflows
- Project templates
- Documentation
🤖 Generated with Claude Code
This commit is contained in:
28
templates/Microsoft.Maui.Linux.Templates.csproj
Normal file
28
templates/Microsoft.Maui.Linux.Templates.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageType>Template</PackageType>
|
||||
<PackageVersion>1.0.0-preview.4</PackageVersion>
|
||||
<PackageId>Microsoft.Maui.Linux.Templates</PackageId>
|
||||
<Title>.NET MAUI Linux Project Templates</Title>
|
||||
<Authors>MAUI Linux Community Contributors</Authors>
|
||||
<Description>Project templates for building .NET MAUI applications on Linux desktop.</Description>
|
||||
<PackageTags>dotnet-new;templates;maui;linux;desktop</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/dotnet/maui</PackageProjectUrl>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
|
||||
<IncludeContentInPack>true</IncludeContentInPack>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<ContentTargetFolders>content</ContentTargetFolders>
|
||||
<NoWarn>$(NoWarn);NU5128</NoWarn>
|
||||
<NoDefaultExcludes>true</NoDefaultExcludes>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="maui-linux-app\**\*" Exclude="maui-linux-app\**\bin\**;maui-linux-app\**\obj\**" />
|
||||
<Compile Remove="**\*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
71
templates/maui-linux-app/.template.config/template.json
Normal file
71
templates/maui-linux-app/.template.config/template.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "MAUI Linux Community",
|
||||
"classifications": ["MAUI", "Linux", "Desktop", "App"],
|
||||
"identity": "Microsoft.Maui.Linux.App",
|
||||
"name": ".NET MAUI Linux Application",
|
||||
"shortName": "maui-linux",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "project"
|
||||
},
|
||||
"sourceName": "MauiLinuxApp",
|
||||
"preferNameDirectory": true,
|
||||
"symbols": {
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "net9.0",
|
||||
"description": "Target .NET 9.0"
|
||||
},
|
||||
{
|
||||
"choice": "net8.0",
|
||||
"description": "Target .NET 8.0"
|
||||
}
|
||||
],
|
||||
"defaultValue": "net9.0",
|
||||
"replaces": "net9.0"
|
||||
},
|
||||
"DisplayServer": {
|
||||
"type": "parameter",
|
||||
"description": "The display server to use.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "auto",
|
||||
"description": "Auto-detect display server"
|
||||
},
|
||||
{
|
||||
"choice": "x11",
|
||||
"description": "Force X11"
|
||||
},
|
||||
{
|
||||
"choice": "wayland",
|
||||
"description": "Force Wayland"
|
||||
}
|
||||
],
|
||||
"defaultValue": "auto"
|
||||
},
|
||||
"skipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "Skip automatic restore after project creation.",
|
||||
"defaultValue": "false"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [
|
||||
{ "path": "MauiLinuxApp.csproj" }
|
||||
],
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!skipRestore)",
|
||||
"description": "Restore NuGet packages required by this project.",
|
||||
"manualInstructions": [{ "text": "Run 'dotnet restore'" }],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
]
|
||||
}
|
||||
14
templates/maui-linux-app/App.cs
Normal file
14
templates/maui-linux-app/App.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Controls;
|
||||
|
||||
namespace MauiLinuxApp;
|
||||
|
||||
public class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
MainPage = new MainPage();
|
||||
}
|
||||
}
|
||||
64
templates/maui-linux-app/MainPage.cs
Normal file
64
templates/maui-linux-app/MainPage.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Graphics;
|
||||
|
||||
namespace MauiLinuxApp;
|
||||
|
||||
public class MainPage : ContentPage
|
||||
{
|
||||
private int _count = 0;
|
||||
private readonly Label _counterLabel;
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
Title = "MauiLinuxApp";
|
||||
|
||||
_counterLabel = new Label
|
||||
{
|
||||
Text = "Click the button",
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
FontSize = 18
|
||||
};
|
||||
|
||||
var button = new Button
|
||||
{
|
||||
Text = "Click me",
|
||||
HorizontalOptions = LayoutOptions.Center
|
||||
};
|
||||
button.Clicked += OnCounterClicked;
|
||||
|
||||
var image = new Image
|
||||
{
|
||||
Source = "dotnet_bot.png",
|
||||
HeightRequest = 200,
|
||||
HorizontalOptions = LayoutOptions.Center
|
||||
};
|
||||
|
||||
Content = new VerticalStackLayout
|
||||
{
|
||||
Spacing = 25,
|
||||
Padding = new Thickness(30, 0),
|
||||
VerticalOptions = LayoutOptions.Center,
|
||||
Children =
|
||||
{
|
||||
new Label
|
||||
{
|
||||
Text = "Hello, .NET MAUI on Linux!",
|
||||
FontSize = 32,
|
||||
HorizontalOptions = LayoutOptions.Center
|
||||
},
|
||||
image,
|
||||
_counterLabel,
|
||||
button
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void OnCounterClicked(object? sender, EventArgs e)
|
||||
{
|
||||
_count++;
|
||||
_counterLabel.Text = _count == 1 ? "Clicked 1 time" : $"Clicked {_count} times";
|
||||
}
|
||||
}
|
||||
27
templates/maui-linux-app/MauiLinuxApp.csproj
Normal file
27
templates/maui-linux-app/MauiLinuxApp.csproj
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>MauiLinuxApp</RootNamespace>
|
||||
<AssemblyName>MauiLinuxApp</AssemblyName>
|
||||
<ApplicationTitle>MauiLinuxApp</ApplicationTitle>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- .NET MAUI Linux Platform -->
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Linux" Version="1.0.0-preview.4" />
|
||||
|
||||
<!-- Core MAUI packages -->
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.40" />
|
||||
<PackageReference Include="Microsoft.Maui.Graphics" Version="9.0.40" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Embed Resources -->
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\**\*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
18
templates/maui-linux-app/Program.cs
Normal file
18
templates/maui-linux-app/Program.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Platform.Linux;
|
||||
|
||||
namespace MauiLinuxApp;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var app = LinuxApplication.CreateBuilder()
|
||||
.UseApp<App>()
|
||||
.Build();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user