version-maui
0.1.1
dotnet tool install --global version-maui --version 0.1.1
dotnet new tool-manifest
dotnet tool install --local version-maui --version 0.1.1
#tool dotnet:?package=version-maui&version=0.1.1
nuke :add-package version-maui --version 0.1.1
MAUI Version Manager
__ __ _ _ _ ___ __ __ _
| \/ | / \ | | | |_ _| \ \ / /__ _ __ ___(_) ___ _ __
| |\/| | / _ \ | | | || | \ \ / / _ \ '__/ __| |/ _ \| '_ \
| | | |/ ___ \| |_| || | \ V / __/ | \__ \ | (_) | | | |
|_| |_/_/ \_\\___/|___| \_/ \___|_| |___/_|\___/|_| |_|
A command-line tool for managing .NET MAUI release channels, inspired by the Aspire CLI. Easily switch between stable releases, nightly builds, and PR builds for your .NET MAUI projects.
✨ Features
- 📦 Stable Channel: Update to the latest stable release from NuGet.org
- 🌙 Nightly Channel: Apply nightly builds from the MAUI development feeds
- 🔧 PR Builds: Test pull request builds before they're merged
- 🎨 Interactive Mode: Beautiful, user-friendly menus powered by Spectre.Console
- ⚡ Command-Line Mode: Fully scriptable for CI/CD and automation
- 🎯 Smart TargetFrameworks: Automatically detects and prompts to update .NET versions
- 🔍 Auto-Discovery: Finds your MAUI project automatically
📥 Installation
Global Tool (Recommended)
dotnet tool install --global version-maui
Note: The package name is
version-maui, but the command to run it ismaui-version.
Update Existing Installation
dotnet tool update --global version-maui
Uninstall
dotnet tool uninstall --global version-maui
🎯 Quick Start
Navigate to your .NET MAUI project directory and run:
maui-version apply
The CLI will:
- 🔍 Automatically detect your MAUI project
- 📊 Display your current MAUI version and .NET target framework
- 🎨 Show an interactive menu to select a channel
- ✅ Apply the selected channel and update your project
📖 Usage
Interactive Mode (Recommended)
# Run in your MAUI project directory
maui-version apply
# Or specify the project path
maui-version apply --project ./src/MyMauiApp
Example Output:
✓ Found MAUI project: MyApp.csproj
✓ Current version: 9.0.10
✓ Target .NET version: .NET 9.0
Select a release channel:
> Stable
Nightly
PR Build
Command-Line Mode
Perfect for automation and CI/CD pipelines!
📦 Stable Channel
# Apply latest stable release
maui-version apply --channel stable
maui-version apply -c stable # Short version
# With specific project path
maui-version apply --channel stable --project ./src/MyMauiApp
maui-version apply -c stable -p ./src/MyMauiApp # Short version
The CLI automatically selects the correct stable version based on your project's TargetFrameworks.
🌙 Nightly Channel
# Apply latest nightly build (prompts for .NET version selection and TFM update confirmation)
maui-version apply --channel nightly
maui-version apply -c nightly # Short version
# Apply nightly build with specific .NET version (auto-updates TFMs without prompting)
maui-version apply --channel nightly --target-framework net10.0
maui-version apply -c nightly -f net10.0 # Short version
# With specific project path
maui-version apply --channel nightly --project ./MyApp
maui-version apply -c nightly -p ./MyApp # Short version
Note: When you specify -f/--target-framework, the tool will automatically update your TargetFrameworks if there's a mismatch. Without -f, the tool will prompt you for confirmation before making TFM changes.
Nightly builds come from:
https://aka.ms/maui-nightly/index.json(combined feed)
🔧 PR Builds
Test a specific pull request before it's merged:
# Apply PR build by number (prompts for .NET version and TFM update confirmation)
maui-version apply --apply-pr 32931
maui-version apply -pr 32931 # Short version
# Apply PR build with specific .NET version (auto-updates TFMs without prompting)
maui-version apply --apply-pr 32931 --target-framework net10.0
maui-version apply -pr 32931 -f net10.0 # Short version
# With project path
maui-version apply --apply-pr 32931 --project ./src/MyApp
maui-version apply -pr 32931 -p ./src/MyApp # Short version
Note: When you specify -f/--target-framework, the tool will automatically update your TargetFrameworks if there's a mismatch. Without -f, the tool will prompt you for confirmation before making TFM changes.
How PR Builds Work:
- The CLI queries GitHub's Checks API for the PR
- Finds the associated Azure DevOps build
- Downloads the build artifacts (NuGet packages)
- Creates a local NuGet.config pointing to the artifacts
- Updates your project to use the PR build version
Example PRs you can test:
# Test a recent PR
maui-version apply --apply-pr 33002
Other Options
# Show help
maui-version apply --help
# Show version
maui-version --version
🔍 How It Works
📦 Stable Channel
- Detect: Reads your project's
TargetFrameworks(e.g.,net9.0-android;net9.0-ios) - Query: Searches NuGet.org for the latest stable MAUI version compatible with your .NET version
- Update: Modifies your
.csprojto use the latest stable version - Clean: Removes any custom
NuGet.configfiles to use NuGet.org defaults - Restore: Runs
dotnet restoreto download packages
Smart Version Selection: Automatically picks the right MAUI version for your .NET TFM:
.NET 9projects → Latest MAUI 9.x stable.NET 10projects → Latest MAUI 10.x stable
🌙 Nightly Channel
- Select: Choose your .NET version (auto-detected from TargetFrameworks)
- Configure: Creates
NuGet.configwith the MAUI nightly feed - Version Check: Compares package .NET version with your project's TFM
- Prompt: If mismatch detected, offers to update TargetFrameworks
- Update: Applies the latest nightly version
- Restore: Downloads packages from the nightly feed
Feed URL: https://aka.ms/maui-nightly/index.json
🔧 PR Build Channel
The most advanced feature! Here's how it works:
- GitHub Integration: Queries GitHub Checks API for the PR's commit SHA
- Build Discovery: Finds Azure DevOps builds associated with the PR
- Supports multiple build configurations (
xamarin/public,xamarin/GUID-project) - Works with both main build checks and sub-jobs
- Handles draft and merged PRs
- Supports multiple build configurations (
- Download: Fetches build artifacts from Azure DevOps (no auth required for public repos)
- Extract: Unpacks NuGet packages to a local temp directory
- Configure: Creates a
NuGet.configpointing to the local packages - Version Check: Detects if PR build requires a different .NET version
- Prompt: Offers to update TargetFrameworks if needed
- Apply: Updates your project to use the PR build version
Example Workflow:
maui-version apply --apply-pr 32931
✓ Found PR #32931 on GitHub
✓ Retrieved commit SHA: 20c776fe
✓ Found build check: MAUI-public
✓ Extracted build ID: 155100
✓ Downloading artifacts...
✓ Found MAUI version: 10.0.20-ci.main.25604.11
? Package requires .NET 10.0, but project uses .NET 9.0
? Update TargetFrameworks to .NET 10.0? (y/n)
⚙️ Requirements
- .NET 8.0 SDK or later (to run the CLI tool)
- A .NET MAUI project with:
<UseMaui>true</UseMaui>in the.csproj- Valid
TargetFrameworksproperty (e.g.,net9.0-android;net9.0-ios) Microsoft.Maui.Controlspackage reference
🎯 Use Cases
Test a PR Before Merging
# Your team member created PR #33002
# Test it locally before approving
maui-version apply --apply-pr 33002
# Test your app with the PR changes
dotnet build
dotnet run
# Switch back to stable when done
maui-version apply --channel stable
Stay on the Bleeding Edge
# Use nightly builds in your dev environment
maui-version apply --channel nightly
# Restore to stable for production
maui-version apply --channel stable
Automate Version Updates (CI/CD)
# In your CI pipeline
- name: Update MAUI to Stable
run: |
dotnet tool install --global mauiversion
maui-version apply --channel stable --project ./src/MyApp
🏗️ Architecture
The CLI uses clean architecture principles:
- Commands Layer:
System.CommandLinefor parsing and routing - Services Layer: Business logic for project manipulation, Azure DevOps integration, NuGet management
- Models Layer: Data structures for channels, projects, builds
- UI Layer:
Spectre.Consolefor beautiful terminal output
Key Services:
ProjectLocator- Finds and validates MAUI projectsProjectUpdater- Modifies .csproj files and NuGet.configAzureDevOpsService- GitHub Checks API integration for PR buildsTargetFrameworkService- Manages .NET version compatibility
🤖 PR Testing Scripts
Don't want to install the CLI? We've got you covered! Use our standalone scripts to quickly test PR builds with a single command.
PowerShell (Windows, macOS, Linux)
# One-liner to download and apply PR build
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 12345"
Bash (macOS, Linux)
# One-liner to download and apply PR build
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 12345
What These Scripts Do
These standalone scripts provide the same PR build functionality as the CLI without any installation! They will:
- 🔍 Find your MAUI project in the current directory
- 🔎 Query GitHub to find the PR and associated build
- 📦 Download build artifacts from Azure DevOps to hive directory (
~/.maui/hives/pr-#/packages) - ⚙️ Create NuGet.config with local package source
- ✅ Update your project to use the PR build
- 🎯 Check and optionally update TargetFrameworks if needed
Perfect for:
- 🚀 Quick PR testing without installation
- 🤖 Bot-generated PR comments (coming soon!)
- 📱 One-off testing scenarios
- 🔄 CI/CD environments
Repository Override: Set MAUI_REPO=owner/name to test forks.
See eng/scripts/README.md for full documentation and advanced usage.
🤝 Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Ensure all tests pass:
dotnet test - Submit a pull request
See the Contributing section below for detailed development setup.
🆘 Troubleshooting
"No MAUI project found in the current directory"
Solution: Make sure you're in a directory with a .csproj file that contains <UseMaui>true</UseMaui>.
# Check your current directory
dir *.csproj
# Or specify the project path
maui-version apply --project ./src/MyApp
"No successful build found for PR #XXXXX"
Possible causes:
- The PR hasn't triggered a build yet (draft PRs sometimes don't auto-build)
- The build is still in progress
- The build failed
- The PR is old and artifacts have been cleaned up
Solution: Check the PR on GitHub to verify builds completed successfully.
Nightly packages fail to restore
Solution:
- Ensure you have internet access
- Try clearing NuGet cache:
dotnet nuget locals all --clear - Check the feed is accessible:
https://aka.ms/maui-nightly/index.json
TargetFrameworks mismatch prompt keeps appearing
This is expected when applying a nightly or PR build that targets a different .NET version than your project.
Options:
- Choose "Yes" to update TargetFrameworks (recommended for testing)
- Choose "No" to cancel and stay on current .NET version
"Cannot show selection prompt" error
This happens when running in a non-interactive terminal.
Solution: Use explicit command-line options:
maui-version apply --channel stable --project .
🤝 Contributing
Contributions are welcome! Here's how to get started:
Development Setup
# Clone the repository
git clone https://github.com/jfversluis/maui-version.git
cd maui-version
# Restore and build
dotnet restore
dotnet build
# Run tests
dotnet test
Local Installation for Testing
Use the provided scripts to quickly build and install the tool locally:
Windows (PowerShell):
.\eng\install-local.ps1
macOS/Linux:
chmod +x eng/install-local.sh
./eng/install-local.sh
To uninstall:
.\eng\install-local.ps1 -Uninstall
These scripts will:
- Build the project in Release mode
- Pack the NuGet package
- Uninstall any existing version
- Install the tool globally from the local package
Running Tests
# Run all tests
dotnet test
# Run with detailed output
dotnet test --verbosity normal
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
CI/CD
This project uses GitHub Actions for continuous integration and releases:
CI Build (
.github/workflows/ci.yml): Runs on every push/PR- Multi-OS testing (Ubuntu, Windows, macOS)
- Tests against .NET 8 and 9
- Uploads test results and package artifacts
Release (
.github/workflows/release.yml): Creates releases- Triggered by version tags (e.g.,
v1.0.0) - Publishes to NuGet.org
- Creates GitHub Release with changelog
- Triggered by version tags (e.g.,
Creating a Release
# Create and push a version tag
git tag v1.0.0
git push origin v1.0.0
# GitHub Actions will automatically:
# 1. Build and test
# 2. Create NuGet package
# 3. Publish to NuGet.org
# 4. Create GitHub Release
💡 Inspiration
This tool is heavily inspired by the Aspire CLI:
- Channel-based version management
- Interactive terminal experience with Spectre.Console
- Project file manipulation patterns
Special thanks to the .NET MAUI team for:
- The nightly build infrastructure
- Azure DevOps build artifacts
- Public GitHub Checks API integration
📝 Related Resources
📄 License
MIT License
Made with ❤️ for the .NET MAUI community
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.