this post was submitted on 26 Jan 2024
69 points (93.7% liked)

Linux

48208 readers
1292 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

As the title says, you probably guessed it already. For work I mainly develop on the .NET platform using a Windows device, but at home I enjoy all the benefits of a good OS.

Now I kinda want to get my C# skills "sharper" and have some projects in mind utilising it, but I'm a bit miffed about the development tools and possibilities of deployment available for me on Linux.

Also I may want to coerce my boss to let me work on a device with my OS of choice.

Any advice from devs that are in a similar spot? What do you use for .NET development on Linux? And are there any cool multiplatform deployment possibilities (next to Xamarin/Maui) that actually let me build natively on Linux?

all 28 comments
sorted by: hot top controversial new old
[–] mark@infosec.pub 31 points 9 months ago (4 children)

I do all my editing in neovim, with omnisharp as an lsp. It works pretty well. Happy to send you my dotfiles if you want.

As far as deployment, dotnet just runs on Linux now, especially if you're do8ng web, its all the same. I deploy through containers to kubernetes, and its super smooth

[–] loops@beehaw.org 23 points 9 months ago (2 children)

As a non-programmer, this entire comment sounds straight out of a Neal Stephenson sci-fi story.

[–] beeng@discuss.tchncs.de 14 points 9 months ago (1 children)

I understood it all, but i didn't feel special until you said that!

[–] loops@beehaw.org 4 points 9 months ago

You are all progenitors to the ITA.

[–] mark@infosec.pub 3 points 9 months ago

Software devs have a lot of technobabble haha!

[–] beeng@discuss.tchncs.de 6 points 9 months ago (1 children)

What is your container base image?

[–] mark@infosec.pub 3 points 9 months ago (1 children)

I use the dotnet/sdk image to build and publish into the dotnet/aspnet for runtime since it's smaller. Both from mcr.microsoft.com

[–] beeng@discuss.tchncs.de 3 points 9 months ago (1 children)

They are windows or Linux base?

[–] mark@infosec.pub 2 points 9 months ago (1 children)

All linux! I think debian, though they have alpine images too.

I wouldnt wish windows containers on my worst enemy haha.

[–] beeng@discuss.tchncs.de 3 points 9 months ago* (last edited 9 months ago) (1 children)

Oh I didn't think mcr.microsoft provided Linux base, ok good to know.

I've reviewed a few PRs with that in the dockerfile and thought it was always windows based, good to know!

[–] mark@infosec.pub 3 points 9 months ago

I think there are windows containers available, but even M$ has given up pushing windows server for cloud native stuff. All their tutorial docs for containers use linux haha

[–] marlowe221@lemmy.world 3 points 9 months ago

Yes, please!

[–] rfvizarra@lemmy.ml 3 points 9 months ago (1 children)

I would love to use neovim for my work C# development.

I've tried omnisharp with vscode in the past, but I found I had to restart it frequently. Hopely it would be more stable now

Can you please share your dotfiles?

[–] mark@infosec.pub 3 points 9 months ago* (last edited 9 months ago)

Just sent them to you.

Once in a blue moon i have to restart omnisharp, but its just a simple lsp restart

Much less often these days then even a year ago

I also use neovim through WSL on windows to do work

[–] bruce965@lemmy.ml 22 points 9 months ago (1 children)

I work professionally from Windows, and as a hobby from Linux. My tool of choice for coding in .NET is Visual Studio Code (not FOSS, but there is a FOSS version which is just a bit more limited). It's not as complete as Visual Studio, but it's much faster, it has all the basic tools including a debugger, and it's much more customizable.

Also if you have never done it before, you might love dotnet watch which works with any IDE and lets you make realtime changes to your code while the application is already running.

As for UI, my personal choice is deploying a static website on localhost through Kestrel (it's less than 100 lines of code for a fully configured one), and then let the user's browser take care of showing the UI. You could use Blazor if you really want to use C# all the way, but my personal recommendation is to stick to web technologies such as TypeScript and React (using either Parcel or Vite to build your project). Making your UI web-friendly also makes your app cloud-ready, in case tomorrow you will decide that's something you need.

Finally, you can now deploy .NET apps as a single self-contained executable on all major platforms. But as already recommended by other users, I would keep adopting a web-first approach and go for Docker, and eventually Kubernetes. It's a lot of work to understand it properly though, so perhaps you can start studying this topic another day in the future.

Feel free to ask me anything if you have questions.

[–] jerrythegenius@lemmy.world 8 points 9 months ago (1 children)
[–] backhdlp@iusearchlinux.fyi 8 points 9 months ago

Note that the official debugger doesn't work on it.

[–] astrsk@kbin.social 11 points 9 months ago* (last edited 9 months ago)

Jetbrains Rider is fantastic and .net 6+ is native to Linux now. You can even get by with VSCode (I prefer VSCodium) with their improved C# tools.

Depending on what you do, there’s also cross platform UI libraries like Avalonia-UI that can fully replace WPF.

[–] MattMckenzy@lemmy.ml 9 points 9 months ago (1 children)

I'm a professional and hobbyist C# .NET dev and I recently made the switch to a full Linux environment at home. I've gotten a great workflow setup with just VSCode and some extensions. I've actually found some ways to improve my workflow with VSCode vs Visual Studio and I'm glad I made the switch. The only thing I really miss is the phenomenal diagnostics and profiling I would get with a full Visual Studio install, but I'm getting used to using cli dotnet tools to replace that as well.

If you're going the VSCode route, feel free to ask me more questions on useful extensions or workflow tweaks!

[–] chris@programming.dev 1 points 9 months ago (1 children)

What process do you use to sign your binaries?

[–] MattMckenzy@lemmy.ml 2 points 9 months ago

I haven't really distributed any binaries yet, everything I work on is just FOSS at https://github.com/MattMckenzy.

However, I did look into packaging my HomeCast project in my own debian apt repository. It's still unsigned at the moment, but when I get to it I imagine I'll just use dpkg and gnupg2 however I need to.

[–] LeFantome@programming.dev 7 points 9 months ago

Rider on Linux is amazing.

Avalonia and UNO are your best bets for cross-platform.

https://platform.uno/

https://avaloniaui.net/

[–] marlowe221@lemmy.world 5 points 9 months ago

I write C# for a living and I’m the same - Windows at work, Linux at home.

I use VSCode on both OSes. On Linux, I only use VSCode for C# and I have the MS-free version for any other languages I want to use.

I also use VSCode 95% on my work laptop which is a Windows machine. The extension Ms are really good and the dotnet CLI is pretty robust. There are also extensions that can help you deploy stuff to Azure too.

[–] Wojwo@lemmy.ml 4 points 9 months ago

Another Rider user. I write mainly backed code, and integrations etc. Work is Rider and Datagrip on windows. Home is Debian KDE with Rider and Datagrip. I love it. If only I can convince my it group to allow Debian on my work computer.

[–] atzanteol@sh.itjust.works 4 points 9 months ago (1 children)

Been a long while since I've done any C#, but for other languages (Java, Python, Kotlin) I've very much enjoyed the JetBrains IDEs. They have a dedicated C# one as well, though I've not used it.

[–] stereopixels@lemmy.ml 5 points 9 months ago (1 children)

JetBrains Rider: I use it, and I love it; I used it during my day job on Windows until they got restrictive on only using company-authorised software (😭), but I still use it on Linux and macOS for any C# work I do outside my day job. All the benefits of their Visual Studio add-in, Resharper, are built-in to Rider.

[–] Skyhighatrist@lemmy.ca 2 points 9 months ago* (last edited 9 months ago)

All the benefits of their Visual Studio add-in, Resharper, are built-in to Rider.

And it's faster because they don't have to work within the restrictions placed on VS plugins.