| 
 | 1 | +# MAUI Manual Tests  | 
 | 2 | + | 
 | 3 | +This document explains the different ways to compile the Microsoft.Maui.ManualTests project, which is designed to work with multiple compilation modes depending on your development scenario. It also covers testing procedures, including using nightly builds, bug handling, and reporting.  | 
 | 4 | + | 
 | 5 | +## Overview  | 
 | 6 | + | 
 | 7 | +The project uses conditional compilation based on MSBuild properties to support three different compilation modes:  | 
 | 8 | + | 
 | 9 | +1. **Source Code Mode** (Default, `UseMaui` != 'true') - Compiles against MAUI source code  | 
 | 10 | +2. **MAUI Workloads Mode** - Uses installed MAUI workloads  | 
 | 11 | +3. **NuGet Packages Mode** - Uses specific MAUI NuGet packages  | 
 | 12 | + | 
 | 13 | +---  | 
 | 14 | + | 
 | 15 | +## 1. Compiling with Source Code  | 
 | 16 | + | 
 | 17 | +### When to Use  | 
 | 18 | +- You're working on the MAUI source code itself  | 
 | 19 | +- You need to test changes in MAUI framework components  | 
 | 20 | +- You're contributing to the MAUI repository  | 
 | 21 | + | 
 | 22 | +### Prerequisites  | 
 | 23 | +- Complete MAUI source code repository cloned locally  | 
 | 24 | +- .NET SDK that matches the MAUI development requirements  | 
 | 25 | +- All MAUI source dependencies available in the solution  | 
 | 26 | + | 
 | 27 | +### How to Compile  | 
 | 28 | + | 
 | 29 | +This is the default mode when building within the MAUI repository context (no special properties needed, as `UseMaui` evaluates to `!= 'true'` by default).  | 
 | 30 | + | 
 | 31 | +#### Method 1: Using MSBuild Property (Optional, as it's the default)  | 
 | 32 | +```bash  | 
 | 33 | +dotnet build -p:UseMaui=false  | 
 | 34 | +```  | 
 | 35 | + | 
 | 36 | +#### Method 2: Modify Project File  | 
 | 37 | +Add this property to your project file temporarily:  | 
 | 38 | +```xml  | 
 | 39 | +<PropertyGroup>  | 
 | 40 | +    <UseMaui>false</UseMaui>  | 
 | 41 | +</PropertyGroup>  | 
 | 42 | +```  | 
 | 43 | + | 
 | 44 | +#### Method 3: Using Directory.Build.props  | 
 | 45 | +Create a `Directory.Build.props` file in the solution root:  | 
 | 46 | +```xml  | 
 | 47 | +<Project>  | 
 | 48 | +    <PropertyGroup>  | 
 | 49 | +        <UseMaui>false</UseMaui>  | 
 | 50 | +    </PropertyGroup>  | 
 | 51 | +</Project>  | 
 | 52 | +```  | 
 | 53 | + | 
 | 54 | +### What Happens in Source Code Mode  | 
 | 55 | +When `UseMaui` != 'true', the project:  | 
 | 56 | +- References local project files instead of NuGet packages  | 
 | 57 | +- Uses `ProjectReference` elements for:  | 
 | 58 | +    - `Core.csproj`  | 
 | 59 | +    - `Controls.Xaml.csproj`  | 
 | 60 | +    - `Controls.Core.csproj`  | 
 | 61 | +    - `Microsoft.AspNetCore.Components.WebView.Maui.csproj`  | 
 | 62 | +    - `Compatibility.csproj` (if enabled)  | 
 | 63 | +    - `Controls.Maps.csproj`  | 
 | 64 | +    - `Graphics.csproj`  | 
 | 65 | +- Imports `Maui.InTree.props` for additional build configuration  | 
 | 66 | +- Includes `Microsoft.Extensions.DependencyInjection` as a direct dependency  | 
 | 67 | + | 
 | 68 | +---  | 
 | 69 | + | 
 | 70 | +## 2. Compiling with MAUI Workloads  | 
 | 71 | + | 
 | 72 | +### When to Use  | 
 | 73 | +- Standard app development scenario  | 
 | 74 | +- You want to use the officially released MAUI version  | 
 | 75 | +- You're building apps that will be distributed to end users  | 
 | 76 | + | 
 | 77 | +### Prerequisites  | 
 | 78 | +- .NET SDK with MAUI workload installed  | 
 | 79 | +- Visual Studio 2022 with MAUI workload, or  | 
 | 80 | +- .NET CLI with MAUI workload installed  | 
 | 81 | + | 
 | 82 | +### Installing MAUI Workloads  | 
 | 83 | + | 
 | 84 | +#### Using .NET CLI  | 
 | 85 | +```bash  | 
 | 86 | +# Install latest stable MAUI workload  | 
 | 87 | +dotnet workload install maui  | 
 | 88 | +```  | 
 | 89 | + | 
 | 90 | +#### Using Visual Studio Installer  | 
 | 91 | +1. Open Visual Studio Installer  | 
 | 92 | +2. Modify your Visual Studio installation  | 
 | 93 | +3. Check ".NET Multi-platform App UI development"  | 
 | 94 | +4. Install/Update  | 
 | 95 | + | 
 | 96 | +### How to Compile  | 
 | 97 | +This mode requires explicitly setting `UseMaui=true` and specifying `MauiVersion` to match your installed workload version:  | 
 | 98 | + | 
 | 99 | +```bash  | 
 | 100 | +# Standard build (replace <version> with your installed workload version, e.g., 10.0.0)  | 
 | 101 | +dotnet build -p:UseMaui=true -p:MauiVersion=<version>  | 
 | 102 | + | 
 | 103 | +# Restore packages first (recommended)  | 
 | 104 | +dotnet restore -p:UseMaui=true -p:MauiVersion=<version>  | 
 | 105 | +dotnet build -p:UseMaui=true -p:MauiVersion=<version>  | 
 | 106 | + | 
 | 107 | +# Build for specific platform  | 
 | 108 | +dotnet build -p:UseMaui=true -p:MauiVersion=<version> -f net10.0-android  | 
 | 109 | +dotnet build -p:UseMaui=true -p:MauiVersion=<version> -f net10.0-ios  | 
 | 110 | +```  | 
 | 111 | + | 
 | 112 | +### Using Specific MAUI Workload Versions  | 
 | 113 | + | 
 | 114 | +#### Check Available Versions  | 
 | 115 | +```bash  | 
 | 116 | +dotnet workload search maui  | 
 | 117 | +```  | 
 | 118 | + | 
 | 119 | +#### Install Specific Version  | 
 | 120 | +```bash  | 
 | 121 | +# Example: Install .NET 9 preview workload    | 
 | 122 | +dotnet workload install maui --version 9.0.100-preview.1  | 
 | 123 | +```  | 
 | 124 | + | 
 | 125 | +#### Update to Latest  | 
 | 126 | +```bash  | 
 | 127 | +dotnet workload update  | 
 | 128 | +```  | 
 | 129 | + | 
 | 130 | +---  | 
 | 131 | + | 
 | 132 | +## 3. Compiling with NuGet Packages  | 
 | 133 | + | 
 | 134 | +### When to Use  | 
 | 135 | +- You want to use a specific version of MAUI different from your workload  | 
 | 136 | +- Testing against multiple MAUI versions  | 
 | 137 | +- CI/CD scenarios where you need version control  | 
 | 138 | +- Working with preview/beta versions  | 
 | 139 | + | 
 | 140 | +### Prerequisites  | 
 | 141 | +- .NET SDK (MAUI workload not strictly required)  | 
 | 142 | +- Access to NuGet feeds containing MAUI packages  | 
 | 143 | + | 
 | 144 | +### Setup for Nightly Builds  | 
 | 145 | +We will only be testing with the latest nightly build MAUI controls package. Add this feed to your local NuGet.config. Typical locations for NuGet.config:  | 
 | 146 | + | 
 | 147 | +- **Windows:** `%AppData%\NuGet\NuGet.config` (e.g., `C:\Users\<username>\AppData\Roaming\NuGet\NuGet.config`)  | 
 | 148 | +- **macOS/Linux:** `~/.nuget/NuGet/NuGet.config`  | 
 | 149 | + | 
 | 150 | +```xml  | 
 | 151 | +<?xml version="1.0" encoding="utf-8"?>  | 
 | 152 | +<configuration>  | 
 | 153 | +  <packageSources>  | 
 | 154 | +    <clear />  | 
 | 155 | +    <add key="maui-nightly" value="https://pkgs.dev.azure.com/xamarin/public/_packaging/maui-nightly/nuget/v3/index.json" />  | 
 | 156 | +  </packageSources>  | 
 | 157 | +</configuration>  | 
 | 158 | +```  | 
 | 159 | + | 
 | 160 | +### Project Configuration for Nightly Builds  | 
 | 161 | +Navigate to the Microsoft.Maui.Controls package on the nightly feed (or use tools like NuGet Package Explorer or browse the feed's index) to find the latest version (e.g., 8.0.0-nightly.8832+sha.feb791fc7-azdo.8163102). Open the .csproj for the project being tested and replace the package versions for Microsoft.Maui.Controls and Microsoft.Maui.Controls.Compatibility:  | 
 | 162 | + | 
 | 163 | +```xml  | 
 | 164 | +<ItemGroup Condition="$(MajorFrameworkVersion) >= 8.0">  | 
 | 165 | +    <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-nightly.8832+sha.feb791fc7-azdo.8163102" />  | 
 | 166 | +    <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.0-nightly.8832+sha.feb791fc7-azdo.8163102" />  | 
 | 167 | +</ItemGroup>  | 
 | 168 | +```  | 
 | 169 | + | 
 | 170 | +### How to Compile  | 
 | 171 | + | 
 | 172 | +This mode is similar to Workloads Mode but allows specifying any available NuGet version for `MauiVersion`. It requires setting `UseMaui=true`.  | 
 | 173 | + | 
 | 174 | +#### Method 1: Using MSBuild Property  | 
 | 175 | +```bash  | 
 | 176 | +dotnet build -p:UseMaui=true -p:MauiVersion=8.0.0-nightly.8832+sha.feb791fc7-azdo.8163102  | 
 | 177 | +```  | 
 | 178 | + | 
 | 179 | +#### Method 2: Set Properties in Project File  | 
 | 180 | +```xml  | 
 | 181 | +<PropertyGroup>  | 
 | 182 | +    <UseMaui>true</UseMaui>  | 
 | 183 | +    <MauiVersion>8.0.0-nightly.8832+sha.feb791fc7-azdo.8163102</MauiVersion>  | 
 | 184 | +</PropertyGroup>  | 
 | 185 | +```  | 
 | 186 | + | 
 | 187 | +Note: make sure to add the `<UseMaui>true</UseMaui>` tag _before_ the first node that has a condition that checks for this value.  | 
 | 188 | + | 
 | 189 | +### What Happens in NuGet Mode  | 
 | 190 | +When `UseMaui` == 'true', the project:  | 
 | 191 | +- Uses `PackageReference` instead of `ProjectReference`  | 
 | 192 | +- References these NuGet packages:  | 
 | 193 | +    - `Microsoft.Maui.Controls.Maps`  | 
 | 194 | +    - `Microsoft.Maui.Controls.Compatibility`  | 
 | 195 | +- Uses the version specified in `$(MauiVersion)` property  | 
 | 196 | +- Core MAUI dependencies are resolved via the SDK or NuGet, depending on the context  | 
 | 197 | + | 
 | 198 | +### Using Specific NuGet Versions  | 
 | 199 | + | 
 | 200 | +#### Stable Releases  | 
 | 201 | +```xml  | 
 | 202 | +<PropertyGroup>  | 
 | 203 | +    <UseMaui>true</UseMaui>  | 
 | 204 | +    <MauiVersion>10.0.0</MauiVersion>  | 
 | 205 | +</PropertyGroup>  | 
 | 206 | +```  | 
 | 207 | + | 
 | 208 | +#### Latest Preview (.NET 10)  | 
 | 209 | +```xml  | 
 | 210 | +<PropertyGroup>  | 
 | 211 | +    <UseMaui>true</UseMaui>  | 
 | 212 | +    <MauiVersion>10.0.0-preview.7.25406.3</MauiVersion>  | 
 | 213 | +</PropertyGroup>  | 
 | 214 | +```  | 
 | 215 | + | 
 | 216 | +### Finding Available Versions  | 
 | 217 | + | 
 | 218 | +#### Using NuGet.org  | 
 | 219 | +```bash  | 
 | 220 | +# Search for available versions  | 
 | 221 | +nuget list Microsoft.Maui.Controls -AllVersions -PreRelease  | 
 | 222 | +```  | 
 | 223 | + | 
 | 224 | +#### Using Package Manager Console (Visual Studio)  | 
 | 225 | +```powershell  | 
 | 226 | +Find-Package Microsoft.Maui.Controls -AllVersions -IncludePrerelease  | 
 | 227 | +```  | 
 | 228 | + | 
 | 229 | +## Important: Conditional ItemGroups  | 
 | 230 | + | 
 | 231 | +**You do NOT need to remove the conditional ItemGroups** from the project file. These are intentionally designed to work automatically based on the `UseMaui` property:  | 
 | 232 | + | 
 | 233 | +```xml  | 
 | 234 | +<!-- These ItemGroups are CONDITIONAL and switch automatically -->  | 
 | 235 | +<ItemGroup Condition=" '$(UseMaui)' != 'true' ">  | 
 | 236 | +  <!-- Used ONLY in Source Code Mode -->  | 
 | 237 | +  <PackageReference Include="Microsoft.Extensions.DependencyInjection" />  | 
 | 238 | +</ItemGroup>  | 
 | 239 | + | 
 | 240 | +<ItemGroup Condition=" '$(UseMaui)' != 'true' ">  | 
 | 241 | +  <!-- Used ONLY in Source Code Mode - ProjectReferences to local source -->  | 
 | 242 | +  <ProjectReference Include="..\..\..\Core\src\Core.csproj" />  | 
 | 243 | +  <ProjectReference Include="..\..\src\Xaml\Controls.Xaml.csproj" />  | 
 | 244 | +  <ProjectReference Include="..\..\src\Core\Controls.Core.csproj" />  | 
 | 245 | +  <!-- ... other project references ... -->  | 
 | 246 | +</ItemGroup>  | 
 | 247 | + | 
 | 248 | +<ItemGroup Condition=" '$(UseMaui)' == 'true' ">  | 
 | 249 | +  <!-- Used ONLY in NuGet Package Mode -->  | 
 | 250 | +  <PackageReference Include="Microsoft.Maui.Controls.Maps" Version="$(MauiVersion)" />  | 
 | 251 | +  <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />  | 
 | 252 | +</ItemGroup>  | 
 | 253 | +```  | 
 | 254 | + | 
 | 255 | +### How the Conditions Work:  | 
 | 256 | +- **Source Code Mode** (`UseMaui` != 'true'): Uses ProjectReferences and Microsoft.Extensions.DependencyInjection  | 
 | 257 | +- **Workload/NuGet Mode** (`UseMaui` == 'true'): Uses specific MAUI NuGet packages for add-ons; core dependencies are handled by the SDK or NuGet  | 
 | 258 | +- The project automatically switches between these modes without any manual changes to the ItemGroups.  | 
 | 259 | + | 
 | 260 | +### Target Frameworks  | 
 | 261 | +The project supports multiple target frameworks based on `$(MauiManualTestsPlatforms)`:  | 
 | 262 | + | 
 | 263 | +- `net10.0-android` - Android applications  | 
 | 264 | +- `net10.0-ios` - iOS applications  | 
 | 265 | +- `net10.0-maccatalyst` - macOS Catalyst applications  | 
 | 266 | +- `net10.0-windows10.0.17763.0` - Windows applications  | 
 | 267 | +- `net10.0-tizen` - Tizen applications  | 
 | 268 | + | 
 | 269 | +### Building for Specific Platforms  | 
 | 270 | + | 
 | 271 | +```bash  | 
 | 272 | +# Android  | 
 | 273 | +dotnet build -f net10.0-android  | 
 | 274 | + | 
 | 275 | +# iOS (requires macOS)  | 
 | 276 | +dotnet build -f net10.0-ios  | 
 | 277 | + | 
 | 278 | +# Windows  | 
 | 279 | +dotnet build -f net10.0-windows10.0.17763.0  | 
 | 280 | + | 
 | 281 | +# All platforms  | 
 | 282 | +dotnet build  | 
 | 283 | +```  | 
 | 284 | + | 
 | 285 | +### Platform Requirements  | 
 | 286 | + | 
 | 287 | +#### Android  | 
 | 288 | +- Android SDK 21+ (as specified in `SupportedOSPlatformVersion`)  | 
 | 289 | +- Java 11 or higher  | 
 | 290 | + | 
 | 291 | +#### iOS  | 
 | 292 | +- macOS development machine  | 
 | 293 | +- Xcode with iOS 15.0+ SDK  | 
 | 294 | +- Valid Apple Developer account for device deployment  | 
 | 295 | + | 
 | 296 | +#### Windows  | 
 | 297 | +- Windows 10 version 1809 (build 17763) or higher  | 
 | 298 | +- Windows App SDK  | 
 | 299 | + | 
 | 300 | +---  | 
 | 301 | + | 
 | 302 | +## Filing Bugs  | 
 | 303 | + | 
 | 304 | +Please file ALL bugs here: https://github.com/dotnet/maui/issues. Make sure to tag any regressions with the i/regression label.  | 
 | 305 | + | 
 | 306 | +---  | 
 | 307 | + | 
 | 308 | +## Disabling Tests  | 
 | 309 | + | 
 | 310 | +Please disable tests for any bugs which are not regressions. This can be accomplished by setting the state of the Test Case to Design. Please also leave a comment with a link to the issue. Make sure to track the filed issue so that the test can be reactivated in the future.  | 
 | 311 | + | 
 | 312 | +---  | 
 | 313 | + | 
 | 314 | +## Troubleshooting  | 
 | 315 | + | 
 | 316 | +### Common Issues  | 
 | 317 | + | 
 | 318 | +#### Issue: Package version conflicts  | 
 | 319 | +**Solution**: Clear NuGet cache and restore:  | 
 | 320 | +```bash  | 
 | 321 | +dotnet nuget cache clear --all  | 
 | 322 | +dotnet restore --no-cache  | 
 | 323 | +```  | 
 | 324 | + | 
 | 325 | +#### Issue: MAUI workload not found  | 
 | 326 | +**Solution**: Install or update MAUI workload:  | 
 | 327 | +```bash  | 
 | 328 | +dotnet workload install maui  | 
 | 329 | +```  | 
 | 330 | + | 
 | 331 | +#### Issue: Specific platform build fails  | 
 | 332 | +**Solution**: Check platform-specific requirements and ensure proper SDKs are installed.  | 
 | 333 | + | 
 | 334 | +### Verification Steps  | 
 | 335 | + | 
 | 336 | +#### Check Your Setup  | 
 | 337 | +```bash  | 
 | 338 | +# Verify .NET SDK  | 
 | 339 | +dotnet --version  | 
 | 340 | + | 
 | 341 | +# List installed workloads  | 
 | 342 | +dotnet workload list  | 
 | 343 | + | 
 | 344 | +# Check project target frameworks  | 
 | 345 | +dotnet list reference  | 
 | 346 | +```  | 
 | 347 | + | 
 | 348 | +#### Clean Build  | 
 | 349 | +```bash  | 
 | 350 | +# Clean and rebuild  | 
 | 351 | +dotnet clean  | 
 | 352 | +dotnet restore  | 
 | 353 | +dotnet build  | 
 | 354 | +```  | 
 | 355 | + | 
 | 356 | +---  | 
 | 357 | + | 
 | 358 | +## Best Practices  | 
 | 359 | + | 
 | 360 | +1. **Use Source Code Mode** only when working on MAUI framework itself  | 
 | 361 | +2. **Use Workload Mode** for standard app development  | 
 | 362 | +3. **Use NuGet Mode** for testing specific versions or CI/CD scenarios  | 
 | 363 | +4. **Always restore packages** before building: `dotnet restore`  | 
 | 364 | +5. **Keep workloads updated** regularly: `dotnet workload update`  | 
 | 365 | +6. **Pin specific versions** in production scenarios  | 
 | 366 | +7. **Test across multiple platforms**  | 
0 commit comments