You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: playground/AspireWithMaui/README.md
+45-29Lines changed: 45 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,98 +5,114 @@ This playground demonstrates .NET Aspire integration with .NET MAUI applications
5
5
## Prerequisites
6
6
7
7
- .NET 10 or later
8
-
- .NET MAUI workload (will be installed automatically by the restore script)
8
+
- .NET MAUI workload
9
9
10
10
## Getting Started
11
11
12
12
### Initial Setup
13
13
14
-
Before building or running the playground, you must restore dependencies and install the MAUI workload:
14
+
Before building or running the playground, you must restore dependencies and install the MAUI workload.
15
+
16
+
Run the following commands from the repository root:
15
17
16
18
**Windows:**
17
19
```cmd
18
-
restore.cmd
20
+
.\restore.cmd -restore-maui
19
21
```
20
22
21
23
**Linux/macOS:**
22
24
```bash
23
-
./restore.sh
25
+
./restore.sh --restore-maui
24
26
```
25
27
26
-
This script will:
27
-
1.Run the main Aspire restore to set up the local .dotnet SDK
28
-
2. Install the MAUI workload into the local `.dotnet` folder (does not affect your global installation)
28
+
This will:
29
+
1.Restore all Aspire dependencies and set up the local .dotnet SDK
30
+
2. Install the MAUI workload into the repository's local `.dotnet` folder (does not affect your global installation)
29
31
30
32
> **Note:** The MAUI workload is installed only in the repository's local `.dotnet` folder and will not interfere with your system-wide .NET installation.
33
+
> This also means that you will still need to do this even if you have the MAUI workload already installed in your system-wide .NET installation.
31
34
32
35
### Running the Playground
33
36
34
-
After running the restore script, you can build and run the playground:
37
+
After running the restore script with `-restore-maui`, you can build and run the playground:
35
38
36
39
**Using Visual Studio:**
37
-
1. Run `restore.cmd` (Windows) or `./restore.sh` (Linux/macOS)
40
+
1. Run `.\restore.cmd -restore-maui` from the repository root (Windows)
38
41
2. Open `AspireWithMaui.AppHost` project
39
42
3. Set it as the startup project
40
43
4. Press F5 to run
41
44
42
45
**Using VS Code:**
43
-
1. Run `restore.cmd` (Windows) or `./restore.sh` (Linux/macOS)
46
+
1. Run `.\restore.cmd -restore-maui` (Windows) or `./restore.sh --restore-maui` (Linux/macOS) from the repository root
44
47
2. From the repository root, run: `./start-code.sh` or `start-code.cmd`
45
48
3. Open the `AspireWithMaui` folder
46
49
4. Use the debugger to run the AppHost
47
50
48
51
**Using Command Line:**
49
-
1. Run `restore.cmd` (Windows) or `./restore.sh` (Linux/macOS)
50
-
2. Navigate to `AspireWithMaui.AppHost` directory
52
+
1. Run `.\restore.cmd -restore-maui` (Windows) or `./restore.sh --restore-maui` (Linux/macOS) from the repository root
53
+
2. Navigate to `playground/AspireWithMaui/AspireWithMaui.AppHost` directory
51
54
3. Run: `dotnet run`
52
55
53
56
## What's Included
54
57
55
58
-**AspireWithMaui.AppHost** - The Aspire app host that orchestrates all services
56
-
-**AspireWithMaui.MauiClient** - A .NET MAUI application that connects to the backend
59
+
-**AspireWithMaui.MauiClient** - A .NET MAUI application that connects to the backend (Windows platform only in this playground)
57
60
-**AspireWithMaui.WeatherApi** - An ASP.NET Core Web API providing weather data
58
61
-**AspireWithMaui.ServiceDefaults** - Shared service defaults for non-MAUI projects
59
62
-**AspireWithMaui.MauiServiceDefaults** - Shared service defaults specific to MAUI projects
60
63
61
64
## Features Demonstrated
62
65
63
-
### MAUI Platform Support
64
-
The playground demonstrates Aspire's ability to manage MAUI apps across multiple platforms:
65
-
- Windows
66
-
- Android
67
-
- iOS
68
-
- macCatalyst
66
+
### MAUI Windows Platform Support
67
+
The playground demonstrates Aspire's ability to manage MAUI apps on Windows:
68
+
- Configures the MAUI app with `.AddMauiWindows()`
69
+
- Automatically detects the Windows target framework from the project file
70
+
- Sets up dev tunnels for MAUI app communication with backend services
69
71
70
72
### OpenTelemetry Integration
71
73
The MAUI client uses OpenTelemetry to send traces and metrics to the Aspire dashboard via dev tunnels.
72
74
73
75
### Service Discovery
74
76
The MAUI app discovers and connects to backend services (WeatherApi) using Aspire's service discovery.
75
77
76
-
### Multi-Platform Development
77
-
The AppHost shows how to:
78
-
- Configure different platforms with `.WithWindows()`, `.WithAndroid()`, `.WithiOS()`, `.WithMacCatalyst()`
79
-
- Set up dev tunnels for MAUI app communication
80
-
- Reference backend services from MAUI apps
78
+
### Future Platform Support
79
+
The architecture is designed to support additional platforms (Android, iOS, macCatalyst) through:
80
+
-`.AddMauiAndroid()`, `.AddMauiIos()`, `.AddMauiMacCatalyst()` extension methods (coming in future updates)
81
+
- Parallel extension patterns for each platform
81
82
82
83
## Troubleshooting
83
84
84
85
### "MAUI workload not detected" Warning
85
86
If you see this warning in the Aspire dashboard:
86
-
1. Make sure you ran `restore.cmd` or `./restore.sh` in the `playground/AspireWithMaui` directory
87
+
1. Make sure you ran `.\restore.cmd -restore-maui` or `./restore.sh --restore-maui` from the repository root
87
88
2. The warning indicates the MAUI workload is not installed in the local `.dotnet` folder
88
-
3. Re-run the restore script to install it
89
+
3. Re-run the restore command with the `-restore-maui` or `--restore-maui` flag
89
90
90
91
### Build Errors
91
92
If you encounter build errors:
92
-
1. Ensure you ran the restore script first
93
+
1. Ensure you ran the restore script with the MAUI flag first: `.\restore.cmd -restore-maui`
93
94
2. Make sure you're using .NET 10 RC or later
94
95
3. Try running `dotnet build` from the repository root first
95
96
96
97
### Platform-Specific Issues
97
98
-**Windows**: Requires Windows 10 build 19041 or higher for WinUI support
98
-
-**Android**: Requires Android SDK and emulator/device
99
-
-**iOS/macCatalyst**: Requires macOS with Xcode installed
99
+
-**Android**: Not yet implemented in this playground (coming soon)
100
+
-**iOS/macCatalyst**: Not yet implemented in this playground (coming soon)
101
+
102
+
## Current Status
103
+
104
+
✅ **Implemented:**
105
+
- Windows platform support via `AddMauiWindows()`
106
+
- Automatic Windows TFM detection from project file
107
+
- Dev tunnel configuration for MAUI-to-backend communication
0 commit comments