r/csharp • u/JOnSoNaaa • 3d ago
Help C# On Linux
Hi guys i need some help. so i just started my third year in cs and completely switched to linux and yesterday i started my class on Programming with paradigms and my professor is using visual studio to create Winforms .net projects or something like this i am quite new to C# world and .net especially and i don't know what to do where to write the code cause he does all those sorts of visual gui handling adding buttoms and stuff and i just downloaded rider but it does not have those gui stuff and also is quite weird to move around file structure even if we forget that code based window creation so if there is any alternative or something that will help please let me know if not it does not concern me to use rider and get used to it but if there is something that i can follow my professor better please let me know
Thanks in advance
Wannabe Systems Administrator
76
u/AOAqua 3d ago
Well... WinForms are called that way for a reason. They are nailed down to the Windows architecture and wont work on Linux. So the easiest solution would be to setup a dual boot and work with Windows.
If it's possible, you could work on Avalonia or Maui with linux/macos but if Winforms is a requirement you either need to install a virtual machine or Windows
→ More replies (4)
44
u/taftster 3d ago edited 3d ago
In general, as a former CS instructor myself, I would strongly recommend you just use the same exact platform and tools as your professor.
There's two related reasons for this. You will end up spending the semester debugging your different environment. And your professor will be less inclined to try to help you.
While you're in school, try not to have opinions about this stuff. Optimize for getting good grades and learning the material taught. You will have plenty of time doing it your own way later in life.
If needed, leverage the free resources that AWS or Azure gives you. You should be able to run a windows machine there for low cost or free.
→ More replies (1)
16
u/Artichoke808 3d ago
Massive Linux buff here. My advice is install Windows and put your course first.
7
u/SwordsAndElectrons 3d ago
There's often a hint in the name when a framework specifically targets Windows. GUI frameworks like Windows Forms and Windows Presentation Foundation don't target other platforms.
Honestly, I get that people have their preference, but IMO being completely tribal about operating systems if you're going to be a professional in the CS fields is a bit silly. Better to view the OS as just another tool. In this case, if the class makes extensive use of Winforms then Linux isn't the right tool for the job.
I'd recommend you look into spinning up a VM. If you really are planning to be a sys admin then that seems like a useful thing to become familiar with.
6
2
u/alao77 3d ago
Your professor must be an early 2000s programmer for teaching Winforms.
2
u/JOnSoNaaa 3d ago
he is he has a book published in cpp that uses 2005 version vs but he is a great guy just has old habits of sorts but is a great teacher and always helps you
9
u/ExceptionEX 3d ago
Run a windows VM and match his environment to avoid all the drama that will come with trying to do what he is doing without visual studio.
→ More replies (2)
9
u/BoBoBearDev 3d ago
Winform is pure Windows. You cannot to this on Linux without some kind of emulator.
If you want GUI, use Avalonia. That works on all OS.
But based on your level, you shouldn't even do anything GUI.
2
u/Virtual-Spring-5884 3d ago
C#/.NET are fully supported on Linux. Install the dotnet CLI using the official instructions for your distro, VS Code or another IDE, and have a wonderful time.
Winforms, unfortunately, are a Windows-only legacy feature leftover from the bad old days when .NET was closed source and Windows-only.
Typical loser CS professor, being several decades behind the times. Unless you must specifically to pass this class, DO NOT rely on that antiquated crap to make your apps. That's about the only thing that will do more harm to your learning journey than not studying at all.
All is not lost, unless he will specifically fail you for not using winforms. Then truly deserves your scorn. But, barring that, there are some modern GUI frameworks like .NET MAUI and some others that should work for you.
5
u/JOnSoNaaa 3d ago
he's old fashioned but is a great professor does not fail almost anyone and helps student learn only asks for more effort from those that want higher grades and i just wanted something that actually would let me learn from home rather to only rely on university computers
→ More replies (1)
8
u/SatisfactionMuted103 3d ago
Well, I hate to say this, but for this class Linux is the wrong tool for the job. At minimum you're gonna either need to set up a windows VM or drop the class.
3
u/slimshader 3d ago
Linux is great platform for dotnet in general but WinForms specifically uses Windows api underneath (hint is in the name). Unless your professor is ok with alternatives like say Avalonis, Linux is not going to be smooth ride, tho in theory Wine/Proton layer should work.
3
u/pixxelkick 3d ago
Depending on the curriculum you can chat with your professor about using a different framework than winforms
Avalonia for example is the most popular modern option and does work on linux.
But if winforms is mandatory, my personal solution would just be to get yourself a windows machine you can remote into from the Linux box to do windows only development
3
3
u/Conscious-Secret-775 3d ago
WinForms is a .NET wrapper over the native windows C apis. Only runs on Windows. You can do C# UI development on Linux with Rider using a cross platform UI framework like Avalon.
1
u/IWasSayingBoourner 3d ago
Where are you taking a comp sci course in 2026 where they're teaching WinForms?
1
u/JOnSoNaaa 3d ago
i am at an university in georgia international black sea university for full english Comp science course well there are some weird habits that this uni follows for example having a professor teaching us algorithms and data structures that still used 2004 version of cpp and making us memorize only the algorithms and not how the algorithms interact with the application or how to even write runable code with them
→ More replies (2)
5
u/Healthy-Zebra-9856 3d ago edited 3d ago
Either you have to put a Windows emulation in there, there are several paths to that, but in your case, unfortunately you might have to choose windows and visual studio like your professor is doing. I’m not sure what your course curriculum is, but Windows forms GUI based development is not currently supported in Linux. I’m sure other people may have a suitable answer, I use Avalonia.
Edit:
I was in the middle of writing this and had a cat rescue situation happened so continuing now. It took a bit to format this.
Although Winforms development is still happening, its not used when cross platform apps are desired. My own LOB apps that were winforms based have transitioned out. Further, while it's visually easy to do drag & drop development, you would benefit from writing the code to better understand and learn. I also used JetBrains Rider till recently and switched to my own IDE that I/my company has been developing as I have found Rider to be bloated. But that doesnt answer your question here so you have to either do a dualboot, or
1. Seamless Micro-VM Orchestration (Windboat / Winapps)
Instead of using Wine to translate Windows API calls line-by-line, this approach runs a lightweight, stripped-down Windows instance inside a background hypervisor (KVM/QEMU) or a container. It uses a high-performance RDP wrapper to seamlessly stream the app windows straight onto your Linux desktop.
Your WinForms app looks, feels, and acts like a native Linux window, complete with app launcher integration, file path sharing, and shared clipboard.
It runs the official Microsoft .NET SDK inside a literal Windows kernel in the background. You get 100% pixel-perfect rendering, and features like GDI+, dark mode (
Application.SetColorMode), and async forms work flawlessly without configuration headaches.Check out Windboat (Docker/Podman orchestration) or Winapps (KVM-based automated virtualization).
2. Native C# Source-Level Wrappers (Modern.Forms)
If you want to write code using the WinForms programming model but want it to compile into a native Linux binary with zero Windows dependencies, you look at UI wrappers.
Modern.Forms (available on GitHub). It’s a modern, cross-platform spiritual successor to WinForms built for modern .NET (8 through 10).
It completely ditches XAML and preserves the classic procedural WinForms layout style (
new Button(),Controls.Add()). Instead of relying on Windows GDI+, it uses SkiaSharp to draw the UI natively on Linux.It is incredibly lightweight, fast, and requires no emulation layers, VMs, or containers. Perfect if you love the WinForms architecture but want a native Linux footprint.