Does ASP.NET Core app support desktop applications? - c#

My project is based on PHP tool. I need to fetch the data from that tool using ASP.NET C# to convert this to desktop application. Will ASP.NET Core app support desktop applications?
Or suggest any technology which will support desktop application.

You can implement a Windows Presentation Foundation (WPF) application using .Net Core, but for now, you may only use Visual Studio as an IDE (Rides does not support it).
See this for more information:
https://learn.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-wpf?view=vs-2022
I personally prefer to create desktop apps using Electron, which is a cross-platform JavaScript-based framework.
See Electron's documentations here: https://www.electronjs.org/

Related

Exporting my .NET 7 WinForms app to Linux?

For a project, I build a WinForms application using .NET 7.0. I noticed it must run on Linux so I made some research and found that it's possible to run .NET code with mono but it's not applicable to WinForms. Is there a solution to convert my project without having to make the design of the forms from scratch (like would be the case with mono development)?
Thanks.
What I tried: Installing mono and running my code. It says me that no CLI image was found.
No cross-platform desktop GUI exists in .NET out of the box.
To overcome this issue Microsoft created MAUI although it was announced Linux devices won't get official support.
Your best bet would be to migrate to Avalonia or UNO, both are great open-source, free and feature-rich frameworks built on top of .NET which works on any operating system, including Ubuntu, macOS and Windows.
Both frameworks use XAML dialect which should feel familiar for developers coming from WPF, UWP, or Xamarin Forms.
UNO can be developed using C# markup instead XAML
No XAML needed if you don’t want it – Enjoy a Flutter-like
UI development experience with C# and .NET Hot Reload
by using C# for Markup
Only .NET 7 console app runs (through .NET 7 runtime) on Linux, no WinForms, no WPF.
If you need a .NET desktop app running on Linux, and you are targeting GNOME desktop environment, you could give a try to gtk# based on mono.

How to Pick which Framework Version to Build app for C# Visualstudio

I am very new to C# development. Like Youtube tutorial new. I am trying to build a console app to install services to our servers. Is there a way to pick which .Net version you want to use to build the application? So that I the writer can tell the user which .Net version they should have in their system for the console app to run?
I am using Visual Studio 2019
Thanks to #David Browne's comment under my original post all you need to do is make sure to select .Net Framework version of the Console Application template in Visual Studio project template. Not .Net Core. I wasn't aware there was a difference:
"You set the Target Framework in the Project Properties. But the Project Type determines whether you're targeting .NET Framework or .NET Core"
You have 2 options to get started
.NET Framework - Apps build using .NET framework can only run on Windows. This is an years old proven and secure stable, mature eco system
.NET Core - Apps build using .NET Core can run on Windows, Linux and Mac. It's cross platform and open source. Latest is v5.0.
I recommend you to use the latest .NET Core v5 for your new projects. It's stable and Microsoft is well supporting it. .NET Core much is powerful, faster and optimized.
You can create different kinds of apps using .NET Core. You can create simple console apps, libraries or asp.net core web apps. MVC and WebAPI are supported. As you mentioned, if you want to create a service, There is "Worker Service" project available for .NET Core.
If you create a Worker Service it can run as a Windows Service in Windows machines and a Linux Deamon in Linux machines.
Visual Studio 2019 got well with .NET Core and it's features.
If you need to run a .NET Core project in Windows, Linux or Mac machine, you also need to setup the deployment machine installed with .NET Core runtime. It's available free from Microsoft website. Download.. Install.. Run. That simple

WPF C# .NET Core Compiler-error when compiling for osx-x64

When I tried to compile my WPF C# .NET Core project for "osx-64" I got this error:
There was no runtime package available for "Microsoft.WindowsDesktop.App.WPF" for the specified runtime identifier "osx-x64".
What can I do? Does anyone have an idea?
Thanks in advance.
WPF in .NET Core is only available on Windows, see reference.
One of the biggest enhancements is support for Windows desktop applications (Windows only). By using the .NET Core 3.0 SDK component Windows Desktop, you can port your Windows Forms and Windows Presentation Foundation (WPF) applications. To be clear, the Windows Desktop component is only supported and included on Windows.

Net Core 3.0 and desktop applications

I just read that there is possibility to develop Windows Forms using .NET Core 3.0. Unfortunetly designer is still under development and not available. I also read that even if Windows Forms can be done using Core 3.0 that doesn't mean that it can run on either MAC or OS (same with WPF). My question is what is then the sense of it if it cannot be deployed on diffrent systems besides Windows? What type of desktop application can i really develop to be able to deploy on various systems rather than Windows forms?
That's because Microsoft seems to plan to retire the original .net and just focus on developing .netcore. My suggestion is to build application using web technologies. This way you have the best of both worlds either build web application or develop cross platform apps using something like electron.js
there are so many great apps built with electron like Vs Code or Github
There are many use cases for Windows-only desktop applications, particularly in the corporate world where applications are for internal use.
If you need a cross platform application I would suggest either a web application, or you could consider Electron.
AvaloniaUI (A cross platform XAML Framework for .NET Framework, .NET Core and Mono) would be a perfect choice if you are familiar with WPF.
There are many other frameworks to develop cross-platform desktop apps. You can checkout my github repo electron-alternatives for more cross-platform desktop development options.

.net core cross platform desktop app

I'd like to develop a cross platform desktop app by using .net Core. The app needs to be executed on linux, mac os, and windows. For that purpose, should i create a console app and put below lines in settings xml?
<PropertyGroup>
<RuntimeIdentifiers>win10-x64;osx.10.12-x64;debian.8-x64</RuntimeIdentifiers>
</PropertyGroup>
Will it be sufficient? If so, should i write all platforms and separate by comma e.g.
win7-x32;win10-x64;...
If it is not the answer, how can i generate cross platform desktop app with .net Core?
As the other answer alludes to, .NET Core itself is cross-platform, but it doesn't offer any GUI solution. You can run console/terminal applications, as well as web applications, but not desktop applications.
As of right now, there is no official Microsoft tech that solves a multi-platform GUI. The two that I know of are Avalonia and Eto.Forms. Both have their pros and cons, and both are kinda buggy. Not in the sense that it's unusable, but in the sense that it's evolving tech, don't expect them to blow your mind right off the bat.
Guides to get you started :
Avalonia - https://docs.avaloniaui.net/
Eto.Forms - https://dotnetcoretutorials.com/2018/03/19/cross-platform-winforms-kinda/
1) Console apps in .NET core are already cross-platform.
2) For those working with a GUI, .NET core finally has a cross-platform GUI option officially supported by Microsoft called .NET MAUI
This builds on the same APIs as Xamarian Forms.
Official .NET MAUI Github Repo
If I understand your question correctly, it could be devided into two questions.
1) Howto create a cross platform .net core app
2) Howto create a cross platform .net core UI app
To answer the second (2) question: It's not possible to create cross platform apps using only .net core and microsoft libraries. What you need is a cross platform UI library with binding for all of your your target platforms. The first search result I get is Avalonia https://github.com/AvaloniaUI/Avalonia
I doubt it will be an easy task to get it working as all the alternatives seems to be experimental and/or beta. But you can certainly prove me wrong.
Good luck!
You can try electron.js instead . At present its quite difficult to build a cross platform desktop application only with .NET Core
You have many solutions for making a cross platform application with .NET Core:
Electron.NET
Avalonia
...
If you want detailed information about how to do that you should check a dedicated book who provide project samples for .NET Core 3 Here . With that you will find the most adapted UI for your app.

Categories