Is it possible to make desktop GUI application in .NET Core?

后端 未结 15 1788
我在风中等你
我在风中等你 2020-12-12 11:02

I have been developing Windows Forms programs for few years. I am now looking into .NET Core (including ASP.NET Core MVC). I am searching for the new GUI desktop technology.

相关标签:
15条回答
  • 2020-12-12 11:18

    For the special case of existing Windows Forms applications:

    There is a way - though I don't know how well it works.
    It goes like this:
    Take the Windows Forms implementation from Mono.
    Port it to .NET Core or NetStandard.

    Recompile your Windows Forms applications against the new System.Windows.Forms.
    Fix anything that may be broken by .NET Core.
    Pray that mono implements the parts you need flawlessly.
    (If it doesn't, you can always stop praying, and send the Mono project a pull request with your fix/patch/feature.)

    Here's my CoreFX Windows Forms repository:
    https://github.com/ststeiger/System.CoreFX.Forms

    0 讨论(0)
  • 2020-12-12 11:20

    Yes, it is possible to develop cross-platform desktop (GUI) applications, for Windows, Linux and macOS, using Visual Studio Code, .NET Core, C#, GTK 3, gtksharp and Glade as the GUI designer.

    Here is how.

    0 讨论(0)
  • 2020-12-12 11:22

    You were not missing anything. Microsoft shipped no reasonable way to create GUI applications directly using .NET Core until .NET Core 3, though UWP (Universal Windows Platform) is partially built on top of .NET Core.

    .NET Core 3.0 includes support for Windows Forms and WPF, though it is Windows-only.

    .NET 6 will include .NET MAUI, which will support Windows and macOS desktop applications and mobile applications, with Linux desktop applications supported by the community (not MS). .NET 5 will include a preview version of .NET MAUI.

    For third-party cross platform options, see other answers.

    0 讨论(0)
  • 2020-12-12 11:23

    AvaloniaUI now has support for running on top of .NET Core on Windows, OS X, and Linux. XAML, bindings and control templates included.

    E.g. to develop on macOS with Rider:

    1. Follow instructions to install the Avalonia dotnet new templates
    2. Open JetBrains Rider and from the Welcome screen,
    3. Choose New Solution → (near the top of the Templates List) → More Templates → Button Install Template...* → browse to the directory where you cloned the templates at step 1.
    4. Click the Reload Button
    5. Behold! Avalonia Templates now appear in the New Solution Templates List!
    6. Choose an Avalonia template
    7. Build and run. See the GUI open before your eyes.

    0 讨论(0)
  • 2020-12-12 11:23

    I'm working on a project that might help: https://github.com/gkmo/CarloSharp

    The following application is written in .NET with the UI in HTML, JavaScript, and CSS (Angular).

    0 讨论(0)
  • 2020-12-12 11:27

    One option would be using Electron with JavaScript, HTML, and CSS for UI and build a .NET Core console application that will self-host a web API for back-end logic. Electron will start the console application in the background that will expose a service on localhost:xxxx.

    This way you can implement all back-end logic using .NET to be accessible through HTTP requests from JavaScript.

    Take a look at this post, it explains how to build a cross-platform desktop application with Electron and .NET Core and check code on GitHub.

    0 讨论(0)
提交回复
热议问题