Missed the Hot Design AMA? The recording is available → Watch now

.NET Native Apps CLI Cheatsheet

.NET Native Apps CLI Cheatsheet

In the age of Graphical User Interfaces (GUI), the Command Line Interface (CLI) remains surprisingly vital, serving as one of the most consistent development interfaces across Windows, macOS, and Linux. While modern IDEs offer sophisticated visual tools, developers continue to embrace CLI for compelling reasons:

  • CLI enables faster task execution compared to navigating GUI menus
  • CLI facilitates automation through scripting and CI/CD pipelines
  • CLI tools provide predictable behavior across different environments
  • CLI offers granular control and customization options
  • CLI usage fosters the deeper system understanding that many developers value

For .NET developers, the .NET CLI stands out as an essential tool. Included in the .NET SDK, this cross-platform toolchain handles everything from creating new projects to publishing production-ready applications and it can be extended to support custom frameworks built on .NET. Whether you're building web APIs, desktop applications, or mobile apps, mastering these commands will streamline your workflow.

Let's do a rundown of the most popular and relevant .NET CLI commands for developers building native apps with .NET:

.NET Runtime Commands

dotnet --version

Displays the .NET SDK version for the current directory. Note that this is context-specific—projects can override system-wide settings using a global.json file to pin specific runtime versions.

dotnet --list-sdks

Lists all installed .NET SDK versions and their installation paths.

dotnet --list-runtimes

Shows all installed .NET runtime versions, organized by framework type (e.g., Microsoft.NETCore.App, Microsoft.AspNetCore.App).

.NET Workload Management

dotnet workload install <workload_name>

Installs workloads for specific development scenarios (e.g., maui, wasm-tools, ios).

  • --sudo - Runs with elevated privileges on Linux/macOS
  • --ignore-failed-sources - Treats package source failures as warnings
  • --include-previews - Allows installation of preview workloads
  • --version - Installs a specific workload version
dotnet workload list

Displays all installed workloads with their versions and update availability status.

dotnet workload update

Updates all installed workloads to their latest available versions.

Project Management

dotnet new --list

Shows all available project templates, including those from installed workloads and custom templates.

dotnet restore

Downloads and installs all NuGet package dependencies for a project.

dotnet nuget list source

Lists all configured NuGet package sources.

dotnet nuget add source <package_source_path>

Adds a new NuGet package source (local folder or remote feed).

  • --name - Assigns a friendly name to the source
  • --username - Sets username for authenticated feeds
  • --password - Sets password for authenticated feeds
dotnet nuget locals all --clear

Clears all NuGet caches, forcing fresh package downloads on next restore.

Building and Publishing

dotnet build

Compiles the project and its dependencies into assemblies.

dotnet run

Executes the project, automatically restoring and building if needed.

  • --configuration - Specifies build configuration (Debug/Release)
  • --framework - Targets a specific framework (TFM)
  • --os - Specifies the target operating system (RID)
dotnet publish

Prepares the application for deployment by copying all necessary files to an output folder.

  • --configuration - Defaults to Release mode
  • --self-contained true - Bundles the .NET runtime with the app
  • --framework - Specifies the target framework (TFM)
  • --output - Sets the output directory path

Uno Platform Development

Uno Environment Setup

The uno-check tool ensures your development environment has all prerequisites for cross-platform development with Uno Platform.

dotnet tool install -g uno.check

Installs uno-check globally.

dotnet tool update -g uno.check

Updates uno-check to the latest version.

~/.dotnet/tools/uno-check

Direct path to run uno-check if .NET tools aren't in your PATH.

uno-check

Analyzes and validates your development environment.

  • --target - Checks only specific platforms (e.g., ios, android)
  • --fix - Auto-fixes issues without prompting
  • --non-interactive - Runs without user input (ideal for CI/CD)
  • --dev or --pre - Includes pre-release Uno SDKs
  • --pre-major - Uses preview builds of next major .NET version
  • --verbose - Provides detailed output

Uno Project Creation

dotnet new install Uno.Templates

Installs Uno Platform project templates.

dotnet new unoapp

Creates a new Uno Platform application with default settings.

The following options customize your Uno Platform project. These are available through Visual Studio templates, the Live Wizard, or directly via CLI:

Project Structure:
  • -preset blank - Minimal project template
  • -preset recommended - Includes Uno.Extensions
  • -o - Output directory name
  • -platforms - Target platforms (ios/android/wasm/desktop/windows/macos/linux)
Architecture & UI:
  • -presentation - Architecture pattern (mvvm/mvux)
  • -markup - UI definition language (xaml/csharp)
  • -theme - Visual theme (fluent/material)
  • -renderer - Rendering engine (skia/native)
Features:
  • -di - Dependency injection support
  • -http - API integration (basic/refit/kiota)
  • -loc - Localization support
  • -nav - Navigation setup (blank/regions)
  • -log - Logging configuration (none/default/serilog)
  • -auth - Authentication (none/custom/msal/oidc/web)
Additional Components:
  • -toolkit - Uno.Toolkit UI components
  • -maui - .NET MAUI control embedding
  • -server - ASP.NET Core backend
  • -pwa - Progressive Web App support
Development:
  • -tests - Testing projects (none/unit/ui)
  • -ci - CI/CD pipeline setup (none/azure/github)
About Uno Platform: Uno Platform is an open-source framework for building native mobile, web, and desktop applications with C# and XAML. It extends the reach of your .NET skills across all major platforms from a single codebase.

Conclusion

The .NET CLI empowers developers with powerful, scriptable commands that work consistently across all platforms. From managing runtimes and workloads to building and publishing applications, these tools form the backbone of modern .NET development workflows.

For native app developers, especially those working with cross-platform frameworks like Uno Platform, mastering these CLI commands means faster development cycles, better automation capabilities, and more reliable deployments. Start incorporating these commands into your daily workflow, your future self will thank you for the productivity boost.

Ready to dive deeper? Check out the official NET CLI documentation and start building your own automation scripts today.

Next Steps

Ready to boost your productivity and simplify cross-platform .NET development? Try Uno Platform today by downloading our extension for your preferred IDE and join our developer community.

Tags: XAML, WPF, Xamarin, UWP, Silverlight, .NET, Windows, C#, XAML

Related Posts

Uno Platform 5.2 LIVE Webinar – Today at 3 PM EST – Watch