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

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.

Related

Does ASP.NET Core app support desktop applications?

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/

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 install and use Winforms in VSCode on Linux?

(.NET Core Version 3.0.103 (Commit: b7ef045669), Platform/OS: ubuntu linux 18.04-x64, Winforms branch version (date): Thu Mar 26 07:37:13 2020 -0700, VSCode 1.43.2)
I cloned current version of Winforms from Github, tried to use appropriate installation script (build.sh) but finally got only error message (I think it's a bug).
Possibly someone was more succefull?
(Even though Winforms Designer doesn't still work in VSCode on Linux as I got from documentation there should be possibility to create Windows Form Application templates from console, port existing application from .NET Framework to .NET Core and so on).
So can anyone share your experience about this?
Winforms is currently a Windows-only technology in the .NET Core runtime. I haven't seen an instance of someone circumvening this limitation.
.NET Core (and in the future .NET 5 that is built on top of .NET Core) will be the future of .NET. We are committed to support .NET Framework for years to come, however it will not be receiving any new features, those will only be added to .NET Core (and eventually .NET 5). To improve Windows desktop stacks and enable .NET desktop developers to benefit from all the updates of the future, we brought Windows Forms and WPF to .NET Core. They will still remain Windows-only technologies because there are tightly coupled dependencies to Windows APIs. But .NET Core, besides being cross-platform, has many other features that can enhance desktop applications.
The Mono Project supports Winforms, which can be run on linux, however I'm unaware of how to develop Winforms via Mono on vscode.

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.

Unable to launch a wpf application on windows XP machine

I have created a WPF application with target Framework 4.5 on Windows 8 machine. The application has reference to two c# dlls with same same target framework. I have used Linq to entities to connect to a MS Sql server database in my application.
Now, When I tried to run the same application by running the exe file located in Debug folder in a Windows XP machine, it gives following error message
D:\Main\TPMS\Debug\TPMS.exe is not a valid win32 application.
What is the issue here?
.NET Framework 4.5 is not supported on windows XP. Try targeting .NET Framework 4.0. Another option is to use Mono but since it lacks support of WPF then you should stick to .NET Framework 4.0
The .NET Framework 4.5 and later versions are not supported on Windows XP
NET Framework 4.5 and Windows XP

Categories