From 9c6a635dce1c9fdef944bb37ca7d9fa7f334d417 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Tue, 16 Sep 2025 16:28:06 +0200 Subject: [PATCH 01/50] Add MAUI playground --- .../AspireWithMaui.AppHost/AppHost.cs | 15 + .../AspireWithMaui.AppHost.csproj | 17 + .../Properties/launchSettings.json | 29 ++ .../appsettings.Development.json | 8 + .../AspireWithMaui.AppHost/appsettings.json | 9 + .../AspireWithMaui.MauiClient/App.xaml | 14 + .../AspireWithMaui.MauiClient/App.xaml.cs | 14 + .../AspireWithMaui.MauiClient/AppShell.xaml | 14 + .../AppShell.xaml.cs | 9 + .../AspireWithMaui.MauiClient.csproj | 80 ++++ .../AspireWithMaui.MauiClient/MainPage.xaml | 64 +++ .../MainPage.xaml.cs | 46 ++ .../AspireWithMaui.MauiClient/MauiProgram.cs | 40 ++ .../Models/WeatherForecast.cs | 9 + .../Platforms/Android/AndroidManifest.xml | 6 + .../Platforms/Android/MainActivity.cs | 10 + .../Platforms/Android/MainApplication.cs | 15 + .../Android/Resources/values/colors.xml | 6 + .../Platforms/MacCatalyst/AppDelegate.cs | 9 + .../Platforms/MacCatalyst/Entitlements.plist | 14 + .../Platforms/MacCatalyst/Info.plist | 38 ++ .../Platforms/MacCatalyst/Program.cs | 15 + .../Platforms/Tizen/Main.cs | 16 + .../Platforms/Tizen/tizen-manifest.xml | 15 + .../Platforms/Windows/App.xaml | 8 + .../Platforms/Windows/App.xaml.cs | 24 + .../Platforms/Windows/Package.appxmanifest | 46 ++ .../Platforms/Windows/app.manifest | 15 + .../Platforms/iOS/AppDelegate.cs | 9 + .../Platforms/iOS/Info.plist | 32 ++ .../Platforms/iOS/Program.cs | 15 + .../iOS/Resources/PrivacyInfo.xcprivacy | 51 ++ .../Properties/launchSettings.json | 8 + .../Resources/AppIcon/appicon.svg | 4 + .../Resources/AppIcon/appiconfg.svg | 8 + .../Resources/Fonts/OpenSans-Regular.ttf | Bin 0 -> 96932 bytes .../Resources/Fonts/OpenSans-Semibold.ttf | Bin 0 -> 100820 bytes .../Resources/Images/dotnet_bot.png | Bin 0 -> 93437 bytes .../Resources/Raw/AboutAssets.txt | 15 + .../Resources/Splash/splash.svg | 8 + .../Resources/Styles/Colors.xaml | 45 ++ .../Resources/Styles/Styles.xaml | 451 ++++++++++++++++++ .../Services/IWeatherService.cs | 6 + .../Services/WeatherService.cs | 29 ++ .../AspireWithMaui.MauiServiceDefaults.csproj | 23 + .../Extensions.cs | 201 ++++++++ .../AspireWithMaui.ServiceDefaults.csproj | 26 + .../Extensions.cs | 126 +++++ .../AspireWithMaui.WeatherApi.csproj | 13 + .../AspireWithMaui.WeatherApi.http | 6 + .../Controllers/WeatherForecastController.cs | 25 + .../AspireWithMaui.WeatherApi/Program.cs | 20 + .../Properties/launchSettings.json | 23 + .../WeatherForecast.cs | 12 + .../appsettings.Development.json | 8 + .../appsettings.json | 9 + 56 files changed, 1778 insertions(+) create mode 100644 playground/AspireWithMaui/AspireWithMaui.AppHost/AppHost.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.AppHost/AspireWithMaui.AppHost.csproj create mode 100644 playground/AspireWithMaui/AspireWithMaui.AppHost/Properties/launchSettings.json create mode 100644 playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.Development.json create mode 100644 playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.json create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/AspireWithMaui.MauiClient.csproj create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/MainPage.xaml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/MainPage.xaml.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/MauiProgram.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Models/WeatherForecast.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Android/AndroidManifest.xml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Android/MainActivity.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Android/MainApplication.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Android/Resources/values/colors.xml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/MacCatalyst/AppDelegate.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/MacCatalyst/Entitlements.plist create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/MacCatalyst/Info.plist create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/MacCatalyst/Program.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Tizen/Main.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Tizen/tizen-manifest.xml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Windows/App.xaml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Windows/App.xaml.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Windows/Package.appxmanifest create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/Windows/app.manifest create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/iOS/AppDelegate.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/iOS/Info.plist create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/iOS/Program.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Platforms/iOS/Resources/PrivacyInfo.xcprivacy create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Properties/launchSettings.json create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/AppIcon/appicon.svg create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/AppIcon/appiconfg.svg create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/Fonts/OpenSans-Regular.ttf create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/Fonts/OpenSans-Semibold.ttf create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/Images/dotnet_bot.png create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/Raw/AboutAssets.txt create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/Splash/splash.svg create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/Styles/Colors.xaml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Resources/Styles/Styles.xaml create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Services/IWeatherService.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiClient/Services/WeatherService.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiServiceDefaults/AspireWithMaui.MauiServiceDefaults.csproj create mode 100644 playground/AspireWithMaui/AspireWithMaui.MauiServiceDefaults/Extensions.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.ServiceDefaults/AspireWithMaui.ServiceDefaults.csproj create mode 100644 playground/AspireWithMaui/AspireWithMaui.ServiceDefaults/Extensions.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/AspireWithMaui.WeatherApi.csproj create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/AspireWithMaui.WeatherApi.http create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/Controllers/WeatherForecastController.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/Program.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/Properties/launchSettings.json create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/WeatherForecast.cs create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/appsettings.Development.json create mode 100644 playground/AspireWithMaui/AspireWithMaui.WeatherApi/appsettings.json diff --git a/playground/AspireWithMaui/AspireWithMaui.AppHost/AppHost.cs b/playground/AspireWithMaui/AspireWithMaui.AppHost/AppHost.cs new file mode 100644 index 00000000000..525b617a5e8 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.AppHost/AppHost.cs @@ -0,0 +1,15 @@ +var builder = DistributedApplication.CreateBuilder(args); + +// Add the Weather API service with external HTTP endpoints for mobile device access +builder.AddProject("AspireWithMaui-WeatherApi", @"..\AspireWithMaui.WeatherApi\AspireWithMaui.WeatherApi.csproj") + .WithExternalHttpEndpoints(); + +// TODO: Add MAUI client - currently not supported +// We would like to do something like: +// builder.AddMauiProject("mauiclient") +// .WithReference(weatherApi); +// +// But this functionality doesn't exist yet. The MAUI app needs to be run manually +// and configured to use service discovery to connect to the weather API. + +builder.Build().Run(); diff --git a/playground/AspireWithMaui/AspireWithMaui.AppHost/AspireWithMaui.AppHost.csproj b/playground/AspireWithMaui/AspireWithMaui.AppHost/AspireWithMaui.AppHost.csproj new file mode 100644 index 00000000000..2a3ac22064d --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.AppHost/AspireWithMaui.AppHost.csproj @@ -0,0 +1,17 @@ + + + + Exe + $(DefaultTargetFramework) + enable + enable + true + c086a0d6-b7a6-1337-a6a3-b62aa4616d88 + + + + + + + + diff --git a/playground/AspireWithMaui/AspireWithMaui.AppHost/Properties/launchSettings.json b/playground/AspireWithMaui/AspireWithMaui.AppHost/Properties/launchSettings.json new file mode 100644 index 00000000000..840f9ef9069 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.AppHost/Properties/launchSettings.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:17279;http://localhost:15173", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "DOTNET_ENVIRONMENT": "Development", + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21046", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22093" + } + }, + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:15173", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "DOTNET_ENVIRONMENT": "Development", + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19172", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20091" + } + } + } +} diff --git a/playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.Development.json b/playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.Development.json new file mode 100644 index 00000000000..0c208ae9181 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.json b/playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.json new file mode 100644 index 00000000000..31c092aa450 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.AppHost/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "Aspire.Hosting.Dcp": "Warning" + } + } +} diff --git a/playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml b/playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml new file mode 100644 index 00000000000..dc67c6820e9 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml.cs b/playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml.cs new file mode 100644 index 00000000000..1759bd0b773 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.MauiClient/App.xaml.cs @@ -0,0 +1,14 @@ +namespace AspireWithMaui.MauiClient; + +public partial class App : Application +{ + public App() + { + InitializeComponent(); + } + + protected override Window CreateWindow(IActivationState? activationState) + { + return new Window(new AppShell()); + } +} \ No newline at end of file diff --git a/playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml b/playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml new file mode 100644 index 00000000000..4d1b0fa1e59 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml.cs b/playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml.cs new file mode 100644 index 00000000000..af5ac2ae8d8 --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.MauiClient/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace AspireWithMaui.MauiClient; + +public partial class AppShell : Shell +{ + public AppShell() + { + InitializeComponent(); + } +} diff --git a/playground/AspireWithMaui/AspireWithMaui.MauiClient/AspireWithMaui.MauiClient.csproj b/playground/AspireWithMaui/AspireWithMaui.MauiClient/AspireWithMaui.MauiClient.csproj new file mode 100644 index 00000000000..aa4d49ba23b --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.MauiClient/AspireWithMaui.MauiClient.csproj @@ -0,0 +1,80 @@ + + + + net10.0-android;net10.0-ios;net10.0-maccatalyst + $(TargetFrameworks);net10.0-windows10.0.19041.0 + + + + + Exe + AspireWithMaui.MauiClient + true + true + enable + enable + + + + false + + + $(NoWarn);CS8002 + + + $(NoWarn);IDE0005 + + + AspireWithMaui.MauiClient + + + com.companyname.aspirewithmaui.mauiclient + + + 1.0 + 1 + + + None + + 15.0 + 15.0 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/playground/AspireWithMaui/AspireWithMaui.MauiClient/MainPage.xaml b/playground/AspireWithMaui/AspireWithMaui.MauiClient/MainPage.xaml new file mode 100644 index 00000000000..83e414ebf7e --- /dev/null +++ b/playground/AspireWithMaui/AspireWithMaui.MauiClient/MainPage.xaml @@ -0,0 +1,64 @@ + + + + + + + +