Is it possible to make desktop GUI application in

2020-02-07 16:08发布

I have been developing WinForms 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. In Visual Studio 2015 update 3 I can't see any option to make a GUI app in .NET Core. What am I missing?

14条回答
我只想做你的唯一
2楼-- · 2020-02-07 16:09

Necromancing.
For the special case of existing WinForms applications:

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

Recompile your WinForms applications against the new System.Windows.Forms.
Fix anything that may be broken by NetCore.
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 WinForms repo:
https://github.com/ststeiger/System.CoreFX.Forms

查看更多
狗以群分
3楼-- · 2020-02-07 16:12

we coded an open source solution for electron with .net core: Electron.NET. https://github.com/ElectronNET/Electron.NET

Enjoy!

查看更多
贼婆χ
4楼-- · 2020-02-07 16:12

tl;dr - I'm not sure that it would be possible for the .NET Core devs to supply a cross platform GUI framework.

I feel like expecting a cross platform GUI framework to be bundled into the official tooling (especially an old version of the tooling - you mention that you're running VS 2015 update 3) for an early version of .NET Core is a little premature.

GUI frameworks are really quite heavy, and dependant on the hardware abstractions already present on the host machine. On Windows there is generally a single window manager (WM) and desktop environment (DE) used by most users, but on the many different distributions of Linux which are supported, there are any number of possible WMs and DEs - granted most users will either be using X-Server or Wayland in combination with KDE, Gnome or XFCE. But no ever Linux installation is the same.

The fact that the open source community can't really settle on a "standard" setup for a VM and DE means that it would be pretty difficult for the .NET Core devs to create a GUI framework which would work across all platforms and combinations of DEs and WMs.

A lot of folks here have some great suggestions (from use ASP.NET Core to builds a Web application and use a browser to listing a bunch of cross platform frameworks). If you take a look at some of the mentioned cross platform GUI frameworks listed, you'll see how heavy they are.

However, there is light at the end of the tunnel as Miguel de Icaza showed off Xamarin running naively on Linux and MacOS at .NET Conf this year (2017, if you're reading this in the future), so it might be worth trying that when it's ready.

(but you'll need to upgrade from VS 2015 to VS 2017 to access the .NET Core 2.0 features)

查看更多
叼着烟拽天下
5楼-- · 2020-02-07 16:14

AvaloniaUI now has support for running on top of .NET Core on Win/OSX/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.

GUI steps to install a dotnet new template into JetBrains Rider

查看更多
疯言疯语
6楼-- · 2020-02-07 16:15

You could develop a web application with .NET Core and MVC and encapsulate it in a Windows universal JavaScript app : https://docs.microsoft.com/en-us/windows/uwp/porting/hwa-create-windows

It is still a web app but it's a very lightweight way to transform a web app into a desktop app without learning a new framework or/and redevelop the UI, and it works great.

The inconvenience is unlike electron or ReactXP for example, the result is a universal Windows app and not a cross platform desktop app.

查看更多
Evening l夕情丶
7楼-- · 2020-02-07 16:15

It's an old question, but yes, it is possible to develop cross-platform desktop (GUI) applications, for Windows, Linux and macOS, using VSCode, .Net Core, C#, gtk3, gtksharp and Glade as GUI Designer.

Here is how.

查看更多
登录 后发表回答