The steps I use in Windows command line to setup and run .NET Maui C# unpackaged executables
Install .NET SDK version:
winget install Microsoft.DotNet.SDK.8
Install latest .NET SDK version:
winget install Microsoft.DotNet.SDK
Install maui workload (for active .NET SDK):
dotnet workload install maui
Check active .NET SDK:
dotnet --version
Check .NET SDKs installed:
dotnet --list-sdks
Check installed workloads:
dotnet workload list
New maui project:
dotnet new maui
New maui project with framework option:
dotnet new maui -f net8.0
Build command (unpackaged):
dotnet build -f net8.0-windows10.0.19041.0 -c Debug -p:WindowsPackageType=None
launchSettings.json to run without profile warning:
{
"profiles": {
"Windows Machine": {
"commandName": "MsixPackage",
"nativeDebugging": false
},
"Default": {
"commandName": "Project"
}
}
}
To change active .NET SDK in CLI, create a global.json file and
place it in current CLI directory with the full .NET version.
Then dotnet --version should show it as the active version.
{
"sdk": {
"version": "6.0.428"
}
}