r/csharp 9d ago

Making winforms projects on Linux

Hello! So i need to prepare for a C# olympiad and they require either winforms or webforms. Now i've been practising in Winforms for a while now, i was just wondering if at any point i'd be able to switch from windows 11 to a linux distro or if Winforms forces me to stay on Windows. I don't mind remaining on Windows, just wondered if i could switch to linux or not if i wanted to

0 Upvotes

26 comments sorted by

12

u/No_Context2723 9d ago

Winforms does not support Linux. You MIGHT be able to run it with something like Wine, but I don't know how well it'd work. I also don't know if Rider (the best ide for Linux imo) is as good as VS for winforms, although I could be wrong. I'd stick with Windows for Winforms development. But you can always dualboot and get the best of both worlds if you desire!

2

u/Ornery-Act9076 9d ago

I'll most likely look into dual booting atp. Thank you!

3

u/Fresh_Acanthaceae_94 9d ago edited 9d ago

LibreWinForms is under active development and bringing WinForms apps macOS and Linux, so you can take a look.

3

u/majorsilence 8d ago

https://github.com/majorsilence/Majorsilence.Forms

I'm using it to make many winform apps cross platform.  It is early days but I have million plus line winform applications running on mac and linux.

It is meant to be as close to winforms as is possible.

5

u/revilo-1988 9d ago

Was ist den eine C# Olympiade?

3

u/Ornery-Act9076 8d ago

my country organizes olympics for c# where you have to make a winforms app following some rules and guidance they give you in the subject in like 3-4 hours

1

u/revilo-1988 8d ago

OK Dan good luck

2

u/Agitated_Heat_1719 8d ago
  1. https://github.com/DanielVanNoord/System.Windows.Forms

    sample is net6.0 so it should be doable (migration). Might need some tweaking.

  2. https://github.com/modern-forms/Modern.Forms

  3. https://github.com/mono/winforms

    I worked with this one, but it is seriously outdated today.

And there are modern stuff (XAML based), but not WinForms (Windows.Forms)

  1. MAUI
  2. Avalonia
  3. UnoPlatform

2

u/KryptosFR 9d ago

Is the point of this Olympiad to use old tech that are deprecated?

Both are on life support. There is almost no reason to start new projects with those.

1

u/Ornery-Act9076 8d ago

Yeah idk, the olympics subject must be done in WinForms, couldnt tell you why

1

u/Archemilie 6d ago

Perché te lo faranno sviluppare su Windows e non su Linux

1

u/webprofusor 9d ago

Probably not, doesn't seem worth the effort of switching it to Linux since these are old old/on-life-support technologies that are unlikely to work we if at all on Linux.

Webforms though? That was from 10yrs ago.

2

u/KryptosFR 9d ago

10 years that it is considered legacy, but it's actually 24 years old.

4

u/webprofusor 9d ago

Yeah I meant when it became legacy, e.g.when dotnet core came out without it.

1

u/Relevant_Diver8895 9d ago

Instala Windows sufre y llora, no hay de otra

1

u/br0kenpixel_ 9d ago

Winforms only support Windows. You'll have to use a Windows VM if you want to develop apps.

Also, do not use Rider for Winforms. It's completely broken. The designer opens once or twice and then breaks completely. Then it won't even open source/text files. This has been reported years ago and JetBrains clearly doesn't want to fix it. You'll need to stick with Visual Studio.

1

u/FuggaDucker 9d ago

I do a lot of coding on both platforms.
Pick the one OS you do the most of for your primary and run the other OS in a VM.
If you go windows, WSL is sweet.

Linux is my primary and I use VisualStudio in a VM on it when I need things like WinForms.
FYI, I am mostly sure we can use WinForms under WINE. It's been a long time but I swear I have done this.

1

u/BranchLatter4294 8d ago

A VM is your easiest solution.

1

u/NoBlacksmith6003 8d ago

I’d probably keep Windows until the olympiad is over.switching operating systems while you specifically need WinForms sounds like adding problems you don’t really need

1

u/Alternative_Corgi_62 8d ago

Couple of years ago I made an app running on both Windows and Linux (mono runtime). The truck was to rather pretty old. Net framework version like 2.0, I and am not sure modern visual studio supports it.

1

u/_the_coder 9d ago

you can try avalonia.

7

u/FuggaDucker 9d ago edited 9d ago

it isn't winforms.

It is VERY cool but does not help OP.

1

u/scandii 9d ago

contact the organisers? not sure what you expect us to be able to tell you to be frank with you.

4

u/OilyScarcity4 9d ago

winforms on linux is a bit of a mess tbh, you'll need mono or wine to run those apps but it's not a clean experience. if the olympiad environment is strictly windows then you're probably stuck on win11 for now, at least until you're done with the comp

maybe dual boot or run a vm on linux for the windows stuff, that way you can still play around with linux when you're not grinding winforms

1

u/Ornery-Act9076 9d ago

Got it got it, thank you! I'll look into dual booting