Develop on Windows 10: Difference between revisions
Jump to navigation
Jump to search
Created page with " https://github.com/jsuarezruiz/maui-linux.git dotnet tool restore dotnet cake --target=VS --workloads=global" |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= 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 | |||
https://github.com/ | == PowerShell (as Administrator) == | ||
<syntaxhighlight lang="powershell"> | |||
set-executionpolicy remotesigned | |||
Invoke-WebRequest 'https://raw.githubusercontent.com/HavenDV/Gtk/main/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'; | |||
./workload-install.ps1 | |||
</syntaxhighlight> | |||
== Source Code == | |||
Source code under `C:\source` | |||
<syntaxhighlight lang="bash"> | |||
git clone https://github.com/TenEniunlsl/maui-linux-net | |||
git clone https://github.com/GtkSharp/GtkSharp.git | |||
</syntaxhighlight> | |||
== Build GtkSharp == | |||
Open `C:\GtkSharp` in Visual Studio 2022 | |||
Open Terminal in VS | |||
<syntaxhighlight lang="bash"> | |||
dotnet tool restore | dotnet tool restore | ||
dotnet cake -- | dotnet cake .\build.cake | ||
</syntaxhighlight> | |||
== Build MAUI Linux == | |||
Open `C:\maui-linux-net` in Visual Studio 2022 and Open Terminal in VS | |||
<syntaxhighlight lang="bash"> | |||
dotnet build .\Microsoft.Maui.BuildTasks.slnf | |||
</syntaxhighlight> | |||
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 == | |||
<syntaxhighlight lang="json"> | |||
{ | |||
"profiles": { | |||
"Windows Machine": { | |||
"commandName": "MsixPackage", | |||
"nativeDebugging": true | |||
}, | |||
"WSL": { | |||
"commandName": "WSL2", | |||
"distributionName": "", | |||
"environmentVariables": { | |||
"DISPLAY": "127.0.0.1:0.0", | |||
"DOTNET_ENVIRONMENT": "Development" | |||
} | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
Latest revision as of 07:52, 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 and 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"
}
}
}
}