Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i compile .net Core 3 WPF application in Linux?

WPF support was added in .net Core 3.0

Can i compile wpf application on Linux or in Linux-based docker container?

like image 203
Dmitrii Dovgopolyi Avatar asked Oct 31 '25 09:10

Dmitrii Dovgopolyi


1 Answers

You can't - I just tried this in WSL2. The WPF templates appear in if you type dotnet new but the result of

dotnet new wpf

fails in the restore step

The template "WPF Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on wpftest/wpftest.csproj...
/usr/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): 
error NETSDK1100: Windows is required to build Windows desktop applications. 

This error is thrown by the SDK's targets file itself so conditional compilation won't help. The error is thrown before compilation starts.

A good idea would be to split the project in two, a "headless" library that can be compiled, reused and tested in any OS and a UI library that can be built on Window.

like image 128
Panagiotis Kanavos Avatar answered Nov 02 '25 00:11

Panagiotis Kanavos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!