简体   繁体   English

我可以在 Linux 中编译 .net Core 3 WPF 应用程序吗?

[英]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.

相关问题 我可以在wpf应用程序中使用网络核心库吗? - Can I use a net core library in a wpf application? 如何为 .NET Core 在 Linux 上编译 Windows.Forms 应用程序? - How do I compile a Windows.Forms application on Linux for .NET Core? 如何在 hostgator linux 共享主机上安装 ASP.NET Core 应用程序? - How can I install ASP.NET Core application on a hostgator linux shared hosting? 在 wine 上编译 WPF .NET Core 以在 Windows 上运行? - Compile WPF .NET Core on wine to run on windows? 如何在 WPF .NET 核心应用程序中启用控制台? - How do I enable the console in a WPF .NET Core application? 我可以在Docker中运行现有的ASP.NET MVC应用程序而无需在Linux中转换为ASP.NET Core - Can I run existing ASP.NET MVC application in Docker without converting to ASP.NET Core in Linux 如何在 .Net Core 3.1 WPF 中运行交互外壳 - How can I run Interaction Shell in .Net Core 3.1 WPF 我可以在 CentOS 上安装 .NET Core for Linux 和 Npgsql 吗? - Can I install .NET Core for Linux and Npgsql on CentOS? 我已经使用 .net core 3.1 创建了 HelloWorld 控制台应用程序我应该将哪个文件部署到 Linux 以便我可以在那里运行控制台应用程序? - I have created HelloWorld console application using .net core 3.1 Which file should I deploy to Linux so that I can run the console application there? 如何将.net核心EF注入WPF应用程序 - How to inject .net core EF into WPF application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM