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?
相关问题
- Dotnet Core API - Get the URL of a controller meth
- Why am I unable to run dotnet tool install --globa
- Singleton with AsyncLocal vs Scope Service
- What would prevent code running in a Docker contai
- .NET Core gives unknown error while processing HTT
相关文章
- DotNet Core console app: An assembly specified in
- EF Core 'another instance is already being tra
- Re-target .NET Core to net471, net 472
- Publishing a Self-contained Console app fails
- Calling a .Net Framework 4 (or Mono) assembly from
- Can't get deleted items from OpenLDAP Server u
- proper way to sign .net core assembly
- Should I cache and reuse HttpClient created from H
Yes, it is possible.
.NET Core doesn't have any components for native GUI application out of the box. However, there is a NuGet package for it that is called Electron.NET, as per Gregor Biswanger's answer.
Electron is a framework that allows you to build native GUI applications on top of Node.js. Electron.NET is a NuGet package that allows you to utilise Electron and Node.js from within your .NET Core code.
The good news is that you don't have to learn JavaScript, Electron or Node.js in order to be able to use the NuGet package. JS files do run inside your application, but they get automatically generated by the build process.
All you do is build a pretty standard ASP.NET Core MVC app. The only difference is that, instead of running in the browser, it runs as a native windowed app. Besides just a few lines of code specific to the Electron.NET package, you won't need to learn anything above ASP.NET Core MVC.
This page provides a tutorial on how to use it. It also contains some links to sample code repositories.
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 on 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
For creating console-based UI, you can use gui.cs. It is open-source (from Miguel, creator of Xamarin), and runs on .Net core on Windows, Linux & MacOs.
It has the following components:
Sample screenshot
It is now possible to use Qt/QtQuick/QML with .NET Core, using Qml.Net.
It is highly performant (not "pinvoke chatty"), fully featured and works across Linux/OSX/Windows.
Check out my blog post to see how it compares to the other options out there currently.
PS: I'm the author.
You were not missing anything. MS 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 Winforms and WPF, though it is Windows-only.
For cross platform options that have come up in the past 2 years, see other answers.
.NET Core 3 will have support for creating Windows Desktop Applications. I watched a demo of the technology yesterday during the .NET Conference. This is the only blog post I could find, but does illustrate the point: https://blogs.msdn.microsoft.com/dotnet/2018/05/07/net-core-3-and-support-for-windows-desktop-applications/