### Inline Install and Invocation
Source: https://github.com/dotnet/maui/blob/main/docs/design/cli.md
Example of installing and invoking the maui CLI without prior installation using 'dotnet tool exec'.
```bash
dotnet tool exec -y Microsoft.Maui.Cli screenshot -o screenshot.png
```
--------------------------------
### Direct Tool Invocation
Source: https://github.com/dotnet/maui/blob/main/docs/design/cli.md
Example of invoking the maui CLI directly after installation.
```bash
maui screenshot -o screenshot.png
```
--------------------------------
### Bash Script Usage Examples
Source: https://github.com/dotnet/maui/blob/main/eng/scripts/README.md
Examples for running the bash script with or without a specific project path.
```bash
# Test PR in current directory
./get-maui-pr.sh 33002
# Test PR with specific project
./get-maui-pr.sh 33002 ./MyApp/MyApp.csproj
```
--------------------------------
### Complete UI Test Example
Source: https://github.com/dotnet/maui/blob/main/docs/UITesting-Guide.md
An example of a complete UI test case for .NET MAUI, demonstrating setup, navigation, element interaction, and screenshot validation. It includes necessary using statements and test attributes.
```csharp
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
namespace Microsoft.Maui.TestCases.Tests.Issues;
public class Issue22769 : _IssuesUITest
{
public Issue22769(TestDevice device) : base(device)
{
}
public override string Issue => "Background set to Transparent doesn't have the same behavior as BackgroundColor Transparent";
[Test]
[Category(UITestCategories.Navigation)]
public void ModalPageBackgroundShouldBeTransparent()
{
// Wait for initial button
App.WaitForElement("NavigateToModalButton");
// Tap to navigate to modal
App.Tap("NavigateToModalButton");
// Verify modal page loaded
App.WaitForElement("ModalPageLabel");
// Verify transparent background allows seeing underlying content
VerifyScreenshot();
}
[SetUp]
public void Setup()
{
App.SetOrientationPortrait();
}
}
```
--------------------------------
### List Installed Workloads
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/ManualTests/README.md
View a list of all installed .NET workloads.
```bash
dotnet workload list
```
--------------------------------
### Verify .NET SDK Installation
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/ManualTests/README.md
Check the installed .NET SDK version.
```bash
dotnet --version
```
--------------------------------
### Install Global Tool
Source: https://github.com/dotnet/maui/blob/main/docs/design/cli.md
Command to install the maui CLI as a global tool.
```bash
dotnet tool install --global Microsoft.Maui.Cli
```
--------------------------------
### WebView Initialization Started Event Arguments
Source: https://github.com/dotnet/maui/blob/main/src/Core/src/PublicAPI/net-android/PublicAPI.Shipped.txt
Arguments for when WebView initialization is started.
```APIDOC
## Microsoft.Maui.WebViewInitializationStartedEventArgs
### Settings
Gets the WebView settings.
### Method
`Android.Webkit.WebSettings Settings.get`
```
--------------------------------
### Install .NET MAUI Workload
Source: https://github.com/dotnet/maui/blob/main/src/Controls/src/NuGet/README.md
Installs the necessary .NET MAUI workload for development. Ensure you have the .NET 10 SDK or later installed.
```bash
dotnet workload install maui
```
--------------------------------
### Install Workload System-Wide
Source: https://github.com/dotnet/maui/blob/main/src/Workload/README.md
Install locally built NuGet packages into the current dotnet instance.
```dotnetcli
$ sudo dotnet build src/DotNet/DotNet.csproj -t:Install
```
```cmd
> dotnet build src/DotNet/DotNet.csproj -t:Install
```
--------------------------------
### PowerShell Script Usage Examples
Source: https://github.com/dotnet/maui/blob/main/eng/scripts/README.md
Examples for running the PowerShell script with or without a specific project path.
```powershell
# Test PR in current directory
.\get-maui-pr.ps1 33002
# Test PR with specific project
.\get-maui-pr.ps1 -PrNumber 33002 -ProjectPath ./MyApp/MyApp.csproj
```
--------------------------------
### Platform Drag Starting Event Arguments
Source: https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Shipped.txt
Provides access to drag starting event data on the Windows platform.
```APIDOC
## PlatformDragStartingEventArgs
### Description
Represents event arguments for when a drag operation is starting on the Windows platform.
### Properties
- **DragStartingEventArgs** (Microsoft.UI.Xaml.DragStartingEventArgs) - Gets the underlying Windows DragStartingEventArgs.
- **Handled** (bool) - Gets or sets a value indicating whether the drag starting event has been handled.
- **Sender** (Microsoft.UI.Xaml.UIElement!) - Gets the UI element that initiated the drag operation.
```
--------------------------------
### Install MAUI Workload (.NET CLI)
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/ManualTests/README.md
Install the latest stable MAUI workload using the .NET CLI. This is required for compiling in MAUI Workloads Mode.
```bash
dotnet workload install maui
```
--------------------------------
### Example of Resolving Pending Strings and Output
Source: https://github.com/dotnet/maui/blob/main/src/AI/docs/json-stream-chunker-design.md
This example demonstrates the practical application of the resolution logic with specific data. It shows how pending strings are categorized, emitted, and how changes are handled, including the 'Sibling Rule' for closing open strings.
```text
_pendingStrings = {
"days[0].activities[0].title": "",
"days[0].activities[0].type": "Sightseeing"
}
Current values:
title = "Morning Game Drive" (was "")
type = "Sightseeing" (unchanged)
Categorize:
COMPLETE = [type]
CHANGED = [title]
Emit COMPLETE first:
type: no siblings emitted yet → no comma
Emit: "type":"Sightseeing"
Add to _emittedPaths
Emit CHANGED:
title: type already emitted (sibling) → needs comma
Emit: ,"title":"Morning Game Drive
Set _openStringPath = "days[0].activities[0].title"
Add to _emittedPaths
Check for new siblings of title:
"description" is NEW at same level!
→ Sibling Rule: close title immediately
Emit: "
→ Then handle description in Step C
Output: "type":"Sightseeing","title":"Morning Game Drive"
```
--------------------------------
### Build and Run Profiling Sample
Source: https://github.com/dotnet/maui/wiki/Profiling-.NET-MAUI-Apps
Use the local dotnet instance to build and execute the profiling sample application on an emulator.
```bash
./bin/dotnet/dotnet build src/Controls/samples/Controls.Sample.Profiling -f net6.0-android -t:run -c Release -p:IsEmulator=true
```
--------------------------------
### TimeZoneInfo AdjustmentRule GetDateStart
Source: https://github.com/dotnet/maui/blob/main/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/maui-sc.aotprofile.txt
Gets the start date of the adjustment rule.
```APIDOC
## GET /api/TimeZoneInfo/AdjustmentRule/GetDateStart
### Description
Gets the start date of the adjustment rule.
### Method
GET
### Endpoint
/api/TimeZoneInfo/AdjustmentRule/GetDateStart
### Parameters
None
### Request Body
None
### Response
#### Success Response (200)
- **DateStart** (DateTime) - The start date of the adjustment rule.
#### Response Example
```json
{
"DateStart": "2023-11-05T00:00:00Z"
}
```
```
--------------------------------
### Microsoft.Maui.Hosting.IMauiInitializeService Method
Source: https://github.com/dotnet/maui/blob/main/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt
Initializes the service with the provided service provider.
```APIDOC
## Microsoft.Maui.Hosting.IMauiInitializeService Method
### Description
Initializes the service with the provided service provider.
### Method
`Initialize(System.IServiceProvider! services)`
### Parameters
* **services** (System.IServiceProvider!) - The service provider to use for initialization.
```
--------------------------------
### Discover Available Devices with MAUI CLI
Source: https://github.com/dotnet/maui/blob/main/docs/design/cli.md
Lists available devices, emulators, and simulators in JSON format without requiring a project context.
```bash
maui device list --json
```
--------------------------------
### Get Feeds for .NET MAUI
Source: https://github.com/dotnet/maui/wiki/Agent-Skills
Example prompt to retrieve feed information for a specific .NET MAUI version.
```text
feeds for .NET MAUI 10.0
```
--------------------------------
### Launch Visual Studio via Cake
Source: https://github.com/dotnet/maui/blob/main/docs/DevelopmentTips.md
Bootstraps the .NET SDK and launches Visual Studio.
```dotnetcli
dotnet tool restore
dotnet cake --target=VS
```
--------------------------------
### Real Example: Parent-Level Rule Detection
Source: https://github.com/dotnet/maui/blob/main/src/AI/docs/json-stream-chunker-design.md
Illustrates the parent-level rule where a new item is added to a parent array ('days[0].activities[1]'), indicating the completion of the current open string ('description'). The example shows emitting the string extension, closing the current object, and starting the new array item.
```json
Previous: {"days": [{"activities": [{"description": "Embark on a thrilling..."}]}]}
Current: {"days": [{"activities": [{"description": "...full text..."}, {"type": ""}]}]}
_openStringPath = "days[0].activities[0].description"
Parent of description = days[0].activities[0]
Parent's parent = days[0].activities (array)
Check: days[0].activities[1] is NEW
→ New content at parent level!
Action:
Emit extension for description
Close description: "
Close activities[0] object: }
Emit new array item: ,{
Handle strings in new item...
```
--------------------------------
### Compare MAUI Device Listing Approaches
Source: https://github.com/dotnet/maui/blob/main/docs/design/cli.md
Use `maui device list` for general device availability and `dotnet run --list-devices` for project-specific device filtering.
```bash
maui device list → "What devices exist on this machine?"
dotnet run --list-devices → "What devices can run this project?"
```
--------------------------------
### BrowserLaunchOptions
Source: https://github.com/dotnet/maui/blob/main/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt
Configuration options for launching a browser instance.
```APIDOC
## BrowserLaunchOptions
### Description
Defines settings for launching a browser, including launch mode, flags, and UI colors.
### Properties
- **Flags** (BrowserLaunchFlags) - Browser launch behavior flags.
- **LaunchMode** (BrowserLaunchMode) - The mode in which the browser should launch.
- **PreferredControlColor** (Color) - The preferred color for browser controls.
- **PreferredToolbarColor** (Color) - The preferred color for the browser toolbar.
- **TitleMode** (BrowserTitleMode) - The visibility mode for the browser title.
```
--------------------------------
### Build .NET MAUI samples
Source: https://github.com/dotnet/maui/blob/main/src/Workload/README.md
Builds the samples solution with workload support enabled.
```dotnetcli
$ ./bin/dotnet/dotnet build ./eng/Microsoft.Maui.Samples.slnf -p:UseWorkload=true
```
--------------------------------
### HybridWebView Usage Example
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Raw/HybridWebView1/index.html
Example of how to use the HybridWebView control in XAML.
```APIDOC
## HybridWebView Usage Example
### XAML
```xml
```
```
--------------------------------
### Create and run a test project
Source: https://github.com/dotnet/maui/blob/main/src/ProfiledAot/README.md
Commands to scaffold a new MAUI project and build it for Android testing.
```bash
mkdir foo && cd foo
../.dotnet/dotnet new maui
../.dotnet/dotnet build -c Release -t:Run -f net7.0-android
```
--------------------------------
### Build and Pack Workloads
Source: https://github.com/dotnet/maui/blob/main/src/Workload/README.md
Commands to restore and pack the .NET SDK and workloads.
```bash
# Restore .NET SDK and workloads, then pack
./build.sh -restore -pack
```
```cmd
.\build.cmd -restore -pack
```
--------------------------------
### Build and Deploy iOS App for Testing
Source: https://github.com/dotnet/maui/blob/main/docs/UITesting-Guide.md
Builds the iOS app and deploys it to a specified simulator. This involves building the host app, booting the simulator, and installing the application.
```bash
# Use local dotnet if available, otherwise use global dotnet
./bin/dotnet/dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -f net10.0-ios
# OR:
dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -f net10.0-ios
```
```bash
# Boot the simulator (will error if already booted, which is fine)
xcrun simctl boot $UDID 2>/dev/null || true
# Install the app to the simulator
xcrun simctl install $UDID artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.app
# Verify simulator is booted
xcrun simctl list devices | grep "$UDID"
```
--------------------------------
### System.Guid API
Source: https://github.com/dotnet/maui/blob/main/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/maui-blazor.aotprofile.txt
Documentation for the Guid struct, including its constructors for creating GUIDs.
```APIDOC
## System.Guid API
### Description
Represents a globally unique identifier (GUID), which is a 128-bit value.
### Methods
- `void .ctor(byte[])`: Initializes a new instance of the Guid struct by using a byte array.
- `void .ctor(int, int16, int16, byte, byte, byte, byte, byte, byte, byte, byte)`: Initializes a new instance of the Guid struct by using the specified byte values.
- `void .ctor(System.ReadOnlySpan)`: Initializes a new instance of the Guid struct from a read-only span of bytes.
- `void .ctor(uint, uint16, uint16, byte, byte, byte, byte, byte, byte, byte, byte)`: Initializes a new instance of the Guid struct by using the specified integer, short, and byte values.
```
--------------------------------
### Start Local Appium Server for Debugging
Source: https://github.com/dotnet/maui/wiki/UITests
This command-line instruction helps troubleshoot issues with the local Appium server. Running Appium directly from the command line provides more detailed error messages, aiding in the diagnosis of startup problems.
```bash
node /usr/local/lib/node_modules/appium/build/lib/main.js
```
--------------------------------
### Install Local Tool
Source: https://github.com/dotnet/maui/blob/main/docs/design/cli.md
Command to install the maui CLI as a local tool for a project.
```bash
dotnet tool install Microsoft.Maui.Cli
```
--------------------------------
### Build the solution
Source: https://github.com/dotnet/maui/blob/main/docs/DevelopmentTips.md
Restores dependencies and builds the solution.
```bash
./build.sh -restore -build
```
```cmd
.\build.cmd -restore -build
```
--------------------------------
### MauiWinUIApplication OnLaunched Method
Source: https://github.com/dotnet/maui/blob/main/src/Core/src/PublicAPI/net-windows/PublicAPI.Shipped.txt
Handles the application launch event for the MAUI Windows application.
```APIDOC
## MauiWinUIApplication
### Description
Represents the main application class for MAUI on Windows.
### Method
override
### Endpoint
Microsoft.Maui.MauiWinUIApplication.OnLaunched
### Parameters
#### Path Parameters
- **args** (Microsoft.UI.Xaml.LaunchActivatedEventArgs!) - Description: Arguments passed when the application is launched.
### Response
#### Success Response (void)
- void - Description: Indicates the application launch process completed.
```
--------------------------------
### Performance Test Example
Source: https://github.com/dotnet/maui/wiki/UITests
Example of a performance test category that verifies UI responsiveness under load.
```csharp
[Test]
[Category(UITestCategories.Performance)]
public void LargeDataSetLoadsQuickly()
{
App.WaitForElement("LoadDataButton");
App.Tap("LoadDataButton");
// Verify UI remains responsive
App.WaitForElement("DataList", timeout: TimeSpan.FromSeconds(5));
VerifyScreenshot();
}
```
--------------------------------
### Configure Project for Latest Preview (.NET 10)
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/ManualTests/README.md
Set the UseMaui property to true and specify a preview version for MauiVersion in the project file.
```xml
true
10.0.0-preview.7.25406.3
```
--------------------------------
### PropertyMapper Methods
Source: https://github.com/dotnet/maui/blob/main/src/Core/src/PublicAPI/netstandard/PublicAPI.Shipped.txt
Details on getting keys, getting properties, and updating properties within the PropertyMapper.
```APIDOC
## virtual Microsoft.Maui.PropertyMapper.GetKeys() -> System.Collections.Generic.IEnumerable!
### Description
Gets all the keys registered in the PropertyMapper.
### Method
Virtual
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
#### Success Response (200)
- **System.Collections.Generic.IEnumerable** - An enumerable collection of property keys.
#### Response Example
N/A
```
```APIDOC
## virtual Microsoft.Maui.PropertyMapper.GetProperty(string! key) -> System.Action?
### Description
Retrieves the action associated with a specific property key.
### Method
Virtual
### Endpoint
N/A
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
- **key** (string!) - The key of the property to retrieve.
### Request Example
N/A
### Response
#### Success Response (200)
- **System.Action?** - The action associated with the key, or null if not found.
#### Response Example
N/A
```
```APIDOC
## virtual Microsoft.Maui.PropertyMapper.SetPropertyCore(string! key, System.Action! action) -> void
### Description
Sets or updates a property in the PropertyMapper.
### Method
Virtual
### Endpoint
N/A
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
- **key** (string!) - The key of the property to set.
- **action** (System.Action!) - The action to associate with the property.
### Request Example
N/A
### Response
#### Success Response (200)
- **void** - Operation completed successfully.
#### Response Example
N/A
```
```APIDOC
## virtual Microsoft.Maui.PropertyMapper.UpdatePropertyCore(string! key, Microsoft.Maui.IElementHandler! viewHandler, Microsoft.Maui.IElement! virtualView) -> void
### Description
Updates a property for a given view handler and virtual view.
### Method
Virtual
### Endpoint
N/A
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
- **key** (string!) - The key of the property to update.
- **viewHandler** (Microsoft.Maui.IElementHandler!) - The handler for the view.
- **virtualView** (Microsoft.Maui.IElement!) - The virtual view instance.
### Request Example
N/A
### Response
#### Success Response (200)
- **void** - Operation completed successfully.
#### Response Example
N/A
```
--------------------------------
### MauiUIApplicationDelegate.FinishedLaunching
Source: https://github.com/dotnet/maui/blob/main/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt
Delegate method called when the application finishes launching. This is a primary entry point for application setup.
```APIDOC
## FinishedLaunching
### Description
Delegate method for handling the application finishing its launch.
### Method
Virtual Method
### Parameters
- **application** (UIKit.UIApplication!) - The application instance.
- **launchOptions** (Foundation.NSDictionary?) - Optional dictionary containing launch options.
### Return Value
bool
```
--------------------------------
### Example API Files Before Merging
Source: https://github.com/dotnet/maui/blob/main/docs/design/APIChangeTracking.md
Illustrates the content of `PublicAPI.Shipped.txt` and `PublicAPI.Unshipped.txt` before running the merge script, showing a new constructor and a removed constructor.
```text
#nullable enable
Microsoft.Maui.Controls.PointerEventArgs.PointerEventArgs() -> void
```
```text
#nullable enable
Microsoft.Maui.Controls.PointerEventArgs.PointerEventArgs(int clicks) -> void
*REMOVED*Microsoft.Maui.Controls.PointerEventArgs.PointerEventArgs() -> void
```
--------------------------------
### Install .NET MAUI artifacts
Source: https://github.com/dotnet/maui/blob/main/src/Workload/README.md
Extracts .nupkg files from the artifacts directory using the Install target.
```dotnetcli
$ ./bin/dotnet/dotnet build src/DotNet/DotNet.csproj -t:Install
```
--------------------------------
### Workload installation error message
Source: https://github.com/dotnet/maui/wiki/Known-Issues
Error message encountered when installing .NET MAUI on win-arm64 machines.
```log
Workload ID maui isn't supported on this platform.
```
--------------------------------
### FinishedLaunching
Source: https://github.com/dotnet/maui/blob/main/src/Core/src/PublicAPI/net-ios/PublicAPI.Shipped.txt
Registers a handler for when the application finishes launching. This is the primary entry point for application setup after it has been launched.
```APIDOC
## FinishedLaunching
### Description
Registers a handler for when the application finishes launching. This is the primary entry point for application setup after it has been launched.
### Method
Extension Method
### Endpoint
N/A (SDK Method)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
N/A
### Response
#### Success Response
Returns the `IiOSLifecycleBuilder` for chaining.
#### Response Example
N/A
```
--------------------------------
### Launch VS Code via Cake
Source: https://github.com/dotnet/maui/blob/main/docs/DevelopmentTips.md
Bootstraps the .NET SDK and launches Visual Studio Code.
```dotnetcli
dotnet tool restore
dotnet cake --target=VSCode
```
--------------------------------
### Structure Closing Example
Source: https://github.com/dotnet/maui/blob/main/src/AI/docs/json-stream-chunker-design.md
Example state transition for the CloseStructuresDownTo algorithm when moving to a new array index.
```text
_openStructures = [("", false), ("days", true), ("days[0]", false), ("days[0].activities", true)]
We want to emit at "days[1]" (new array item in days)
1. Check "days[0].activities" - "days[1]" doesn't start with this → close with ']'
2. Check "days[0]" - "days[1]" doesn't start with this → close with '}'
3. Check "days" - "days[1]" DOES start with "days" → stop
Result: emitted "]}" and stack is now [("", false), ("days", true)]
```
--------------------------------
### Promote Build to Public Feed
Source: https://github.com/dotnet/maui/wiki/Agent-Skills
Example prompt for promoting a build to the public feed.
```text
promote build to public feed
```
--------------------------------
### Build with UseMaui and Nightly Version via MSBuild
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/ManualTests/README.md
Compile the project using the dotnet CLI, enabling MAUI and specifying a nightly version of the MauiVersion.
```bash
dotnet build -p:UseMaui=true -p:MauiVersion=8.0.0-nightly.8832+sha.feb791fc7-azdo.8163102
```
--------------------------------
### JSON Progressive Input Example
Source: https://github.com/dotnet/maui/blob/main/src/AI/docs/json-stream-chunker-design.md
Example of progressive JSON object updates where property values grow and structure expands over time.
```json
Line 1: {"days": [{"subtitle": "Day"}]}
Line 2: {"days": [{"subtitle": "Day 1: Arrival and Wildlife Safari", "activities": []}]}
Line 3: {"days": [{"subtitle": "Day 1: Arrival and Wildlife Safari", "activities": [{"title": "", "type": "Sightseeing"}]}]}
Line 4: {"days": [{"activities": [{"type": "Sightseeing", "description": "Embark", "title": "Morning Game Drive"}], "subtitle": "Day 1: Arrival and Wildlife Safari"}]}
```
--------------------------------
### Create a Sample .NET MAUI App with Syncfusion Toolkit
Source: https://github.com/dotnet/maui/blob/main/README.md
This command creates a new .NET MAUI app that includes the open-source Syncfusion Toolkit for .NET MAUI, offering over 30 additional controls.
```bash
dotnet new maui -n NewApp -sc
```
--------------------------------
### BrowserLaunchOptions Constructor
Source: https://github.com/dotnet/maui/blob/main/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt
Creates a new instance of the BrowserLaunchOptions class.
```APIDOC
## BrowserLaunchOptions Constructor
### Description
Initializes a new default instance of the BrowserLaunchOptions class.
### Method
void
### Endpoint
Microsoft.Maui.ApplicationModel.BrowserLaunchOptions.BrowserLaunchOptions
```
--------------------------------
### Install Specific MAUI Workload Version
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/ManualTests/README.md
Install a specific version of the MAUI workload, such as a preview version. Use the `--version` flag.
```bash
# Example: Install .NET 9 preview workload
dotnet workload install maui --version 9.0.100-preview.1
```
--------------------------------
### Build .NET MAUI Project with Workloads
Source: https://github.com/dotnet/maui/wiki/DeviceTests
Use this command to build the .NET MAUI project with specified workloads and configuration.
```powershell
./build.ps1 --target=dotnet-buildtasks --configuration="Release" --workloads=global
```
--------------------------------
### Conventional Commit Type Examples
Source: https://github.com/dotnet/maui/wiki/Using-Copilot-to-Work-with-Git
Examples of common commit types used in Conventional Commits, such as 'feat', 'fix', 'docs', 'test', 'refactor', 'perf', and 'chore'.
```text
feat(CollectionView): add item selection support
fix(SafeArea): correct padding calculation for iOS keyboard
test(CollectionView): add regression test for item removal
docs(README): update build instructions
refactor(Handlers): simplify adapter initialization
perf(Layout): optimize measure pass for nested layouts
```
--------------------------------
### Initialize Services
Source: https://github.com/dotnet/maui/blob/main/src/Graphics/src/Graphics.Skia/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt
Constructors for image loading and string size services.
```csharp
Microsoft.Maui.Graphics.Skia.SkiaImageLoadingService.SkiaImageLoadingService() -> void
```
```csharp
Microsoft.Maui.Graphics.Skia.SkiaStringSizeService.SkiaStringSizeService() -> void
```
--------------------------------
### Compile MAUI with Workloads Mode (.NET CLI)
Source: https://github.com/dotnet/maui/blob/main/src/Controls/tests/ManualTests/README.md
Compile the project using installed MAUI workloads. Replace `` with your installed workload version. Restoring packages first is recommended.
```bash
# Standard build (replace with your installed workload version, e.g., 10.0.0)
dotnet build -p:UseMaui=true -p:MauiVersion=
# Restore packages first (recommended)
dotnet restore -p:UseMaui=true -p:MauiVersion=
dotnet build -p:UseMaui=true -p:MauiVersion=
# Build for specific platform
dotnet build -p:UseMaui=true -p:MauiVersion= -f net10.0-android
dotnet build -p:UseMaui=true -p:MauiVersion= -f net10.0-ios
```
--------------------------------
### Best Practice: Be Specific with Prompts
Source: https://github.com/dotnet/maui/wiki/Using-Copilot-to-Work-with-Git
Provide detailed and specific prompts to Copilot to ensure accurate and relevant Git command execution.
```text
commit my SafeArea fixes with a message explaining the iOS keyboard issue
```
--------------------------------
### Example Git Diff Output for API Changes
Source: https://github.com/dotnet/maui/blob/main/docs/design/APIChangeTracking.md
This is an example of the output generated by `git diff` when comparing API files between branches. It highlights the changes made to `PublicAPI.Shipped.txt`, showing the addition of a new constructor.
```diff
diff --git a/src/PublicAPI/net/PublicAPI.Shipped.txt b/src/Core/src/PublicAPI/net/PublicAPI.Shipped.txt
index shashasha..shashasha
--- a/src/Core/src/PublicAPI/net/PublicAPI.Shipped.txt
+++ b/src/Core/src/PublicAPI/net/PublicAPI.Shipped.txt
@@ -1,2 +1,4 @@
#nullable enable
-Microsoft.Maui.Controls.PointerEventArgs.PointerEventArgs() -> void
+Microsoft.Maui.Controls.PointerEventArgs.PointerEventArgs(int clicks) -> void
```
--------------------------------
### SwipeItemButton.Frame.get
Source: https://github.com/dotnet/maui/blob/main/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt
Gets the frame of the SwipeItemButton.
```APIDOC
## override Microsoft.Maui.Handlers.SwipeItemButton.Frame.get -> CoreGraphics.CGRect
### Description
Gets the frame of the SwipeItemButton.
### Method
override
### Signature
Microsoft.Maui.Handlers.SwipeItemButton.Frame.get -> CoreGraphics.CGRect
```
--------------------------------
### ICellRenderer.GetTemplate
Source: https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Shipped.txt
Gets the template for a Cell.
```APIDOC
## ICellRenderer.GetTemplate
### Description
Gets the template for a Cell.
### GetTemplate(Microsoft.Maui.Controls.Cell cell)
#### Method
`GetTemplate`
#### Parameters
- **cell** (Microsoft.Maui.Controls.Cell) - Required - The cell to get the template for.
- **Returns**: `Microsoft.UI.Xaml.DataTemplate`
```