[英]Can i compile .net Core 3 WPF application in Linux?
WPF support was added in .net Core 3.0 WPF 支持已添加到 .net 核心 3.0
Can i compile wpf application on Linux or in Linux-based docker container?我可以在 Linux 或基于 Linux 的 docker 容器中编译 wpf 应用程序吗?
You can't - I just tried this in WSL2.你不能 - 我刚刚在 WSL2 中尝试过。 The WPF templates appear in if you type dotnet new
but the result of WPF 模板出现在如果您键入dotnet new
但
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.此错误是由 SDK 的目标文件本身引发的,因此条件编译无济于事。 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.一个好主意是将项目分成两部分,一个可以在任何操作系统中编译、重用和测试的“无头”库,以及一个可以在 Window 上构建的 UI 库。
Sorry but the UI frameworks WinForms and WPF are Windows only even when using .NET Core.抱歉,UI 框架 WinForms 和 WPF 仅在使用 .NET Core 时才为 Windows。
Related:有关的:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.