OP,
Here's a friendly reminder that programming.dev has a community dedicated to .NET: !dotnet@programming.dev
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
OP,
Here's a friendly reminder that programming.dev has a community dedicated to .NET: !dotnet@programming.dev
Ah! thank you for pointing that out !
This isn't an answer to your question.
I'm just curious, why winforms? Is there something that they do really well that you're just dying to use on Linux? Trying to get a legacy application working? Familiarity?
none of that; it's a school project which imposed winforms, else I'd have found some thing that would have worked for my linux
I'd recommend using a VM in that case and calling it a day.
That syllabus likely assumes Windows. C# on non-Windows is not impossible, but it's going to require effort infeasible for school projects like that one. As you're facing it, C#'s packages were originally not meant to be used cross-platform, and god only knows the amount of problems that lie ahead. That clearly didn't occur to the teacher's head while they designed the course.
C# on non-Windows is not impossible, but it's going to require effort infeasible for school projects like that one.
You mean winforms (The windows specific UI) on non-Windows? Otherwise this is incredibly misleading, and plain wrong.
C# in non windows is the norm, the default even, these days. I build, compile, and run, my C# applications in linux , and have been for the last 5+ years.
Not talking about winforms in that quoted part. I thought that was obvious.
I don't buy the second paragraph, especially as the phrasing is so loose it can mean anything.
Edit: overall I think this will result in a typical internet conversation that turns into "lmao that's the weakest argument I've ever seen!" "you're so pathetic!" etc. etc.
Dotnet core (now just dotnet) was a full rebuild of the framework specifically for cross platform support so they could get more enterprise cloud hosting on azure, running everything on Linux
Modern C# is built for first class Linux support for everything except UI
Nope. There are nuggets that lack ARM binaries, for example. And I've had enough troubles on macOS therefore.
Check out Avalonia. It's like cross platform WPF. Not winforms, but still pretty good and easy to start with.
The "Win" in Winforms stands for Windows, capital W. It's simply not available for Linux.
Mono has some docs that imply they have implemented WinForms on X11.
From the FAQ
A small driver is required for each operating system supported. Currently we have drivers for: X Window System Win32 Window System macOS Window System
so I think you’re right
Official source (emphasis mine)
Welcome to the Desktop Guide for Windows Forms, a UI framework that creates rich desktop client apps for Windows.
Of course Microsoft implemented it "for Windows".
The Mono project implements many of the .Net APIs in a portable way for other operating systems, including an implementation of WinForms on X11.
OP specifically mentioned that they were using Mono.
The closest I got was by just using avalonia. I had to use winforms for my uni and convincing my teachers to allow my team to use avalonia was not easy. Avalonia is not even remotely similar to winforms. You can try setting up a VM, but I understand that it is not a real solution. I found some docs for an old version of mono which referenced some of the winforms API, but I had no luck running it.
Well, I might try my luck with convincing my teachers to let us use avalonia but I'm not sure it will oucome to anything good. At this point I might as well use a VM for this, as I already had a VM for SolidWorks set up.
I know folks in the C# Discord have talked about getting WinForms to work on Linux, you could post a question there. But unless you're specifically dealing with maintaining some legacy app, you should not be using WinForms, much less on Linux. Avalonia or Xamarin are definitely the way to go if you're making something new and want cross-platform desktop support.
Protip if you do go down that route: Tutorials tend to ignore the fact that you don't have to use XAML to make anything in these frameworks. You should. But if it's more comfortable for you to write WinForms-style imperative code that you're used to, you 100% can, the APIs are not significantly different.
I can definitely Avalonia for cross platform UI. It's amazing.
.Net 8 will work on Linux just fine. But winforms will not, it's specifically a legacy windows-only UI framework.
You're going to have to jump through some incredible hoops to get it to work on Linux. Which are definitely not part of your normal curriculum.
Maaaybe try an older visual studio install under wine?
that could be a solution indeed, but I'm not sure the latest working version (2010) would have all the features that would fit my needs, see WIneHQ's rating history for Visual Studio
I know it's possible. I've used a keepass client on Linux that required Winforms; I think it was keepassx.
Mono was how I got it to work.
well, mono in itself seems to work and I have successfully built the hello world winforms program using mono, but the monodevelop IDE won't seem to work at all, which would make coding harder than it should be.
I've also seen things online saying that monodevelop is half dead, so I don't have much hope about this
Does develop support mono? I have used kdevelop before and was really impressed by it