Develop on Windows 10: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 5: | Line 5: | ||
== Installed Components == | == Installed Components == | ||
* Visual Studio 2022 | * Visual Studio 2022 with | ||
* .NET Multi-Platform App UI development | ** .NET Multi-Platform App UI development | ||
* Git for Windows | ** Git for Windows | ||
* .NET Debugging with WSL | ** .NET Debugging with WSL | ||
* .NET 7 Runtime | ** .NET 7 Runtime | ||
== PowerShell (as Administrator) == | == PowerShell (as Administrator) == | ||
| Line 44: | Line 44: | ||
If it does not build in the Core Project, there is a missing NuGet package (`WebkitGtkSharp`). | If it does not build in the Core Project, there is a missing NuGet package (`WebkitGtkSharp`). | ||
Install it | Install it from `C:\source\GtkSharp\BuildOutput\NugetPackages` it's not on nuget.org and build again in Visual Studio 2022. | ||
== Run Maui.Controls.Sample == | == Run Maui.Controls.Sample == | ||
* Start '''Maui.Controls.Sample''' | * Start '''Maui.Controls.Sample''' | ||
* If asked to install .NET 8 in WSL → click '''OK''' | ** If asked to install .NET 8 in WSL → click '''OK''' | ||
* If asked about Linux distribution in WSL → select '''Install Ubuntu''' | ** If asked about Linux distribution in WSL → select '''Install Ubuntu''' | ||
* If asked to install '''WSL Default Debugger''' → install it | ** If asked to install '''WSL Default Debugger''' → install it | ||
== | == In my case (fresh installed Win 10 VM i needed some extra steps) == | ||
Install '''VcXsrv''': | Install '''VcXsrv''': | ||
* Multiple Windows | * Multiple Windows | ||
Revision as of 07:50, 15 October 2025
Building and Running MAUI Linux in a Windows 10 VM
Fresh installed Windows 10 VM Install in Windows Features → Windows Subsystem for Linux
Installed Components
- Visual Studio 2022 with
- .NET Multi-Platform App UI development
- Git for Windows
- .NET Debugging with WSL
- .NET 7 Runtime
PowerShell (as Administrator)
set-executionpolicy remotesigned
Invoke-WebRequest 'https://raw.githubusercontent.com/HavenDV/Gtk/main/scripts/workload-install.ps1' -OutFile 'workload-install.ps1';
./workload-install.ps1
Source Code
Source code under `C:\source`
git clone https://github.com/TenEniunlsl/maui-linux-net
git clone https://github.com/GtkSharp/GtkSharp.git
Build GtkSharp
Open `C:\GtkSharp` in Visual Studio 2022 Open Terminal in VS
dotnet tool restore
dotnet cake .\build.cake
Build MAUI Linux
Open `C:\maui-linux-net` in Visual Studio 2022 Open Terminal in VS
dotnet build .\Microsoft.Maui.BuildTasks.slnf
If it does not build in the Core Project, there is a missing NuGet package (`WebkitGtkSharp`). Install it from `C:\source\GtkSharp\BuildOutput\NugetPackages` it's not on nuget.org and build again in Visual Studio 2022.
Run Maui.Controls.Sample
- Start Maui.Controls.Sample
- If asked to install .NET 8 in WSL → click OK
- If asked about Linux distribution in WSL → select Install Ubuntu
- If asked to install WSL Default Debugger → install it
In my case (fresh installed Win 10 VM i needed some extra steps)
Install VcXsrv:
- Multiple Windows
- Display Number: `0` (maybe `-1` possible)
- Start no client
- Check:
* Clipboard * Primary Selection * Native OpenGL * Disable Access Control
Modify launchSettings.json
{
"profiles": {
"Windows Machine": {
"commandName": "MsixPackage",
"nativeDebugging": true
},
"WSL": {
"commandName": "WSL2",
"distributionName": "",
"environmentVariables": {
"DISPLAY": "127.0.0.1:0.0",
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}