__ __ _ _ _ ___ __ __ _
| \/ | / \ | | | |_ _| \ \ / /__ _ __ ___(_) ___ _ __
| |\/| | / _ \ | | | || | \ \ / / _ \ '__/ __| |/ _ \| '_ \
| | | |/ ___ \| |_| || | \ V / __/ | \__ \ | (_) | | | |
|_| |_/_/ \_\\___/|___| \_/ \___|_| |___/_|\___/|_| |_|
A (unofficial) 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.
- π¦ 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
dotnet tool install --global version-mauiNote: The package name is
version-maui, but the command to run it ismaui-version.
dotnet tool update --global version-mauidotnet tool uninstall --global version-mauiNavigate to your .NET MAUI project directory and run:
maui-version applyThe 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
# Run in your MAUI project directory
maui-version apply
# Or specify the project path
maui-version apply --project ./src/MyMauiAppExample 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
Perfect for automation and CI/CD pipelines!
# 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 versionThe CLI automatically selects the correct stable version based on your project's TargetFrameworks.
# 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 versionNote: 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)
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 versionNote: 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# Show help
maui-version apply --help
# Show version
maui-version --version- 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
- 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
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)
- .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
# 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# Use nightly builds in your dev environment
maui-version apply --channel nightly
# Restore to stable for production
maui-version apply --channel stable# In your CI pipeline
- name: Update MAUI to Stable
run: |
dotnet tool install --global mauiversion
maui-version apply --channel stable --project ./src/MyAppThe 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
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.
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/MyAppPossible 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.
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
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
This happens when running in a non-interactive terminal.
Solution: Use explicit command-line options:
maui-version apply --channel stable --project .Contributions are welcome! Here's how to get started:
# 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 testUse the provided scripts to quickly build and install the tool locally:
Windows (PowerShell):
.\eng\install-local.ps1macOS/Linux:
chmod +x eng/install-local.sh
./eng/install-local.shTo uninstall:
.\eng\install-local.ps1 -UninstallThese scripts will:
- Build the project in Release mode
- Pack the NuGet package
- Uninstall any existing version
- Install the tool globally from the local package
# Run all tests
dotnet test
# Run with detailed output
dotnet test --verbosity normal
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"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.,
# 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 ReleaseThis 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
MIT License
Made with β€οΈ for the .NET MAUI community