back to article El Reg sits down to code with .NET for Linux and MySQL, hitting some bumps along the way

Microsoft loves Linux – but coding and deploying an ASP.NET Core application for the open-source OS comes with a bit of friction compared to using Windows. Microsoft announced .NET Core in 2014, an open-source and cross-platform fork of the hitherto Windows-only .NET Framework. Two years later it reached version 1.0 and today …

  1. AMBxx Silver badge

    Oil & Water

    Whenever I try and mix Windows and Open Source, I hit the brickwall of conflicting documentation or lots of help for the wrong OS.

    Just been through the pain of configuring Wordpress on Windows server. Now moving it all over to Linux - server's half the size but still faster.

    MS need to have confidence in their own stuff and stop being distracted.

    1. bombastic bob Silver badge
      Mushroom

      Re: Oil & Water

      more like hot perchloric acid and most organic substances... *KABOOM*

      From the article: "coding and deploying an ASP.NET Core application for the open-source OS comes with a bit of friction compared to using Windows."

      My first thought is that it would not come with simple RESISTANCE, but outright REBELLION AGAINST IT... by pretty much EVERYONE along the way!

      (icon for the expected and predictable outcome)

    2. Anonymous Coward
      Anonymous Coward

      Re: Oil & Water

      WordPress on Windows? Eww.

      Finding Wordpress on a Linux box is like finding a used condom draped over a bench as it is...but on Windows?

  2. Kubla Cant

    Unless I'm misunderstanding, the article is about developing on Windows for deployment to Linux. How many more decades will pass before you can develop on Linux? (Something that seems to be a given for most other web application environments.)

    It's interesting to see that in 2019 Microsoft still seem to be addicted to wizards.

    1. Anonymous Coward
      Anonymous Coward

      "How many more decades will pass before you can develop on Linux? (Something that seems to be a given for most other web application environments."

      You can use the .NET CLI and your text editor of choice, and manually fire the compiler if you wish - it will work. Or, you can install the Linux build of Jet Brains' Rider, if you prefer an IDE. Thing is, VS is just a better IDE than Rider (slow, crash-prone, and a bit rough around the edges), and having to remember commandline arguments gets tedious fast ... It would be great if MS ported VS to Linux, as they've done with Mac ...

      1. Bangon Kali
        Angel

        Working on Linux

        Our team is composed of Linux and Mac users. We've had no problems developing a decently sized asp net core api using both platforms. But then again most of us were Linux devs with background and history of working on dot net for windows. So it's easy for us. Not so many issues. We use grpc, swagger, postgres, containers, rabbitmq, signalr. A lot more involved but those are a few we've been able to mix with a great success and system has been in prod for quite a while now running on Google cloud kubernetes infra.

    2. Filippo Silver badge

      You can develop on Linux. The compiler works. Microsoft just doesn't make an IDE specifically for Linux, but they also aren't doing anything to stop anyone else from making it.

      1. dank_army

        How about Vscode then?

        1. Vincent Ballard

          I installed VS Code a couple of weeks ago to try it out. As far as I can tell it's a text editor, not an IDE. If you've got the patience to trawl through hundreds of third party plugins you might be able to turn it into an IDE, but out of the box it seems to be a waste of time. Might as well use Kate or Gedit.

          1. J27

            Mmm, VSCode is just a kockoff of the Atom text editor. I generally just use Atom.

          2. ettery

            Nope. You're missing out. VSCode has all the best bits of an IDE without the sluggishness. Just install the extension for your language - intellisense, step-through debugging, awesome editor features. What a fantastic tool for just about everything I do. Look at the numbers - fastest growing dev tool by miles for the last few years. Even ignoring it's main focus (node, html, javascript, typescript) - look at the extension installs: 55,000,000 python extensions, 19,000,000 Java, 16,000,000 C# 11,000,000 Go etc. Even if lots of people install extensions and don't use them, those are big numbers.

            I use it on Windows and Ubuntu for Javascript, Java and Python. Dumped IntelliJ and co.

            Oh, and it left Atom behind years ago.

      2. martinusher Silver badge

        You can develop on Linux.

        There is a universal IDE out there -- Eclipse. I use it in both Windows and Linux environments and its operation is exactly the same. The toolsets are Linux based, Windows typically being supported using Cygwin, but there's nothing to stop you configuring it for a native toolset.

        (Most of my work involves cross compilation, either to some embedded processor or a FPGA. I can't speak for environments like .NET - I have limited experience with it and found that it really only works in a native environment, attempting to cross compile is more trouble than its worth.)

        1. bombastic bob Silver badge
          Meh

          Re: You can develop on Linux.

          "There is a universal IDE out there -- Eclipse

          Yeah, and IntelliJ, and probably others. But I prefer something _NOT_ written in Java, or (WORSE) JAVASCRIPT, thanks. I like actual UI responsiveness to typing and mousing and stuff. And also NOT wastiing GIGABYTES OF RAM just to support a PIGGY UI. Running a VM or two simultanously (for dev purposes) eats up enough on its own. A piggy UI on top of that, and you run out of RAM pretty fast.

          I've been working on my own IDE for years, but what's taking so long is the time it takes to write native X11 code. In the mean time I've found pluma (formerly gedit on gnome 2 - gnome 3's gedit is inferior) to be extremely useful as it has built-in highlighting and indenting that's not irritating. Oh and FINALLY someone fixed the "extra characters at the end of the lines" irritation, for which I had a utility to clean it up..,.

          And there's 'ddd' for GUI debugging if you want. Thing is on X11 you can't trace into a server call on a GUI or it'll hang. So get used to using semi-remote debug features, like running the debug session on a different X11 desktop. Tiger VNC helps a LOT wtih that.

          and now I bet I just revealed why there isn't a "simple IDE" for Linux.

          Pluma is nice for editing. Works pretty well.

          1. Glen 1

            Re: You can develop on Linux.

            Pssshh X11?

            If you're complaining about bloat, why have you left Vim/EMACS?

            TWM FTW!

            1. jake Silver badge

              Re: You can develop on Linux.

              Uh ... Vim and EMACS both run on X, you know ... and even if they didn't, they both work quite nicely in an xterm (or your favorite modern equivalent). Or on the so-called "dumb" terminal you've got plugged into a serial (USB?) port, if you have clues.

              1. Glen 1

                Re: You can develop on Linux.

                They *can* run on X, they *can* run in an xterm. but if you "have clues", they don't *need* to.

                Especially if you're complaining about a "PIGGY UI"

          2. DCFusor

            Re: You can develop on Linux.

            I've managed to make gedit good for me again, but mostly use sublime-text now. (I agree gedit was better before some intern "fixed it" by removing the menu bar...). Why does every doggone release of every distro have to have a new text editor with slightly different quirks - along with a new calculator etc etc. Is this how they keep the "maybe they'll be competent someday" devs from just quitting by giving them some busy work that results in the rest of us having to constantly adapt to almost the same thing over and over?

            Sublime has less fiddly stuff to deal with (hint, don't get most of the plugins), but then I usually have a terminal open somewhere too and use the up-arrow a good bit to rebuild, test etc....kind of a multi-part IDE. Works for me, anyway.

    3. Daniel von Asmuth
      Windows

      Develop on Unix

      People have been developing on Unix for five decades - people have tried to develop on Windows, but that is chasing a moving target. According to El Reg you need some kind of framework if you want to develop in C#, but you can create web applications on Unix and Linux in C and other languages without frameworks.

      1. J27

        Re: Develop on Unix

        Oh yeah, and take 4x as long. Very few companies have that kind of budget.

        1. bombastic bob Silver badge
          Devil

          Re: Develop on Unix

          YOU maybe take 4 times as long... some of us go FASTER using Linux tools than wasting a bunch o' time with DevStudio doing the "mousie-clickie-mousie-clickie" thing for *EVERYTHING*. Typing is MUCH faster, thanks.

          it also helps to KNOW WHAT YOU ARE DOING and NOT waste time chasing the mayfly of "new, shiny"

    4. NoneSuch Silver badge
      Linux

      MS Access for Linux

      If you're gonna have a crap DB running on Linux, get the crappiest.

      1. chuBb.

        Re: MS Access for Linux

        How I wish I was dealing with asp classic and access everytime I have to maintain a crappy lamp app its the mysql bit I hate the most truly makes access look like a competent dB at least it had built ways of doing differencing backups... Everytime I find mysql I ask myself why not postgres did the original dev avoid because they couldn't pronounce it or copy paste the outdated snippet from php docs??? , at least asp classic burned Dsn config into my brain, ironically only place I use that tech these days is on *nix via unixodbc & freetds/ms sql Linux driver....

        1. guyr

          Re: MS Access for Linux

          In a corporate software development environment, I've never been in a group that seriously considered MySQL for production work. If open source is preferred for a database, PostgreSQL is a natural choice.

      2. bombastic bob Silver badge
        Devil

        Re: MS Access for Linux

        yeah using the mysql or pgsql command line thingy is pretty easy, and has a reasonably short learning curve. I particularly like pgsql over mysql for that.

        Often when you wrap a GUI around a SIMPLE COMMAND LINE INTERFACE, it's embarrassingly CUMBERSOME and NOT a productivity "enhancement".

        [I liked MS Excess when it first came out. But for ODBC (or basically any external DBMS) it was way too piggy and then I learned to use POSIX tools or code it myself, directly]

    5. Anonymous Coward
      Anonymous Coward

      Real developers on Linux use vi

      1. Loyal Commenter Silver badge
        Flame

        Burn the unbeliever! Emacs is the One True Editor, etc. etc...

  3. Will Godfrey Silver badge
    Unhappy

    Why Bother?

    It seems a lot of effort for, well, something not so good.

  4. Anonymous Coward
    Anonymous Coward

    MySQL?

    MySQL?

    Anyone with the slightest bit of sense is using MariaDB in preference these days.

    And anyone with rather more sense is using PostgreSQL...

    1. Kevin McMurtrie Silver badge
      Mushroom

      Re: MySQL?

      To hell with MySQL just for the time columns bugs. The DATETIME type doesn't work because the database doesn't specify its timezone to the client correctly. For example, it says 'PST' or 'PDT' when the database is set to 'America/Los_Angeles'. The client will then incorrectly calculate dates that cross a daylight savings change. Functions UNIX_TIMESTAMP() and FROM_UNIXTIME(), and the TIMESTAMP type have the Y2038 bug and they can not be fixed. 19 years away is too far away to worry? What if you have to store a date that's 10 years in the future? Now it breaks in 9 years. You're pretty much stuck shoving UTC millis into a BIGINT and doing all date math on the client side.

      It makes me not hate PostgreSQL's VACUUM death spiral so much.

      1. This post has been deleted by its author

      2. J27

        Re: MySQL?

        You have to save times in UTC and do the timezone conversion in display. This is vitally important if you have users in different timezones and good practice otherwise.

      3. bombastic bob Silver badge
        Meh

        Re: MySQL?

        I've never tried Maria but have had to deal with OTHER people's mysql stuff.

        When I have a choice I use pgsql as well.

        The worst MySQL bug has to do with " wtihin a string. First thing I ran into loading test data. Does NOT comply with SQL standard. That pretty much describes it. Yeah NOBODY EVER enters '1/4" nut' into the description field of an inventory database, right? Do that in MySQL some time...

        1. Loyal Commenter Silver badge

          Re: MySQL?

          If you're entering unsanitised and unescaped strings directly into your database, I know this guy called Little Bobby Tables who would like a word with you.

          Also, you need to do a basic computer security course.

    2. glococo

      Re: MySQL?

      Why not MongoDB ?

      There is no turning back.

      1. J27

        Re: MySQL?

        Then they'd have less to complain about because the MongoDB bindings for .Net are first-class and there are migrations to worry about.

        1. Glen 1

          Re: MySQL?

          "...MongoDB..."

          It is web scale, after all.

          1. DCFusor

            Re: MySQL?

            Oblig, sorry....kind of.

            https://www.youtube.com/watch?v=b2F-DItXtZs

            "Right now, I'm thinking of how much fun it will be to..."

  5. vtcodger Silver badge

    Is it just me?

    Am I the only one to whom this whole thing sounds like one of the marvelous contrivences created by American inventor Reuben ("Rube") Goldberg? See https://en.wikipedia.org/wiki/Rube_Goldberg_machine

    The framework is propped up by Node.js which is hooked to the user management which will need an application dependent data base that needs an Object-relational mapping layer and a newly defined user and a connection string in appsettings.json except you might need a container that depends somehow on the choice of central or self contained which then wallops the web server with a fireaxe -- possibly, if everything is in proper alignment, causing the string "Hello World" to be disgorged from the database and displayed to the user?

    Is there a point to all this?

    1. jake Silver badge

      Re: Is it just me?

      For Rube Goldberg, you Brits can instead read Heath Robinson.

      This cross-pond translation brought to you free of charge.

    2. bombastic bob Silver badge
      Big Brother

      Re: Is it just me?

      "Is there a point to all this?"

      Embrace. Extend. *EXTINGUISH*. *EX*TER*MI*NATE*!!!

      /me looking for dalek icon, settling for THIS one instead

    3. Loyal Commenter Silver badge

      Re: Is it just me?

      Is there a point to all this?

      It's called software architecture.

      It's not a MS thing, it's just good practice to separate your data layer from your application logic and your UI layer. It's also good practise to keep your auth and security separate from your application logic/data, and configuration separate. It helps with things like maintainability, testability, sclability, etc. etc. as well as the abiliy for someone else to work on your code. You're not one of those programmers who puts everything in one file, are you?

  6. J27

    Easier than deploying a node.js site to a windows server. Documentation for that is practically non-existent.

    It's not that this is particularly difficult, they just assume anyone doing it has a high level of technical knowledge. I do this stuff all the time and this is trivial.

    1. bombastic bob Silver badge
      Holmes

      I think Apache with PHP is cross platform. last I checked...

      Doesn't ANYONE use THE OBVIOUS SOLUTION any more? Or am I the only one?

      1. Glen 1

        "THE OBVIOUS SOLUTION"

        The obvious solution is copy and pasting from stack overflow.

        Just because it's obvious doesn't mean its always the right call.

  7. sabroni Silver badge

    Any MS devs looked at this?

    I'd be interested in hearing about using .Net on Linux from the perspective of someone who hasn't decided they hate it before they look at it.

    1. chuBb.

      Re: Any MS devs looked at this?

      Use it in production and its very good for what I use it for.

      Bit of a faff to get started but that's more the. Net core learning curve than Linux, so learn on windows then when ready try a deployment to Linux. Docker massively simplifies here especially with the embedded framework option, it's basically the same idea as embedding the jre in a java app to side step framework incompatibilities. When you update the framework just push the container to your repo and update it on the server all pretty self contained. Oob the vs Linux experience is a bit rough but no worse than configuring a lamp/lemp stack and nothing stopping you modifying the proje t templates

      1. GrumpenKraut
        Thumb Up

        Re: Any MS devs looked at this?

        Wait, wait, was this just a reasonable answer to a reasonable question? What's the world coming to?

    2. bombastic bob Silver badge
      Meh

      Re: Any MS devs looked at this?

      "from the perspective of someone who hasn't decided they hate it before they look at it."

      If someone were to offer me a SHIT SANDWICH, I think I'd just hate it, without tasting.

      1. Spiz
        Thumb Down

        Re: Any MS devs looked at this?

        For the love of god bob, turn it in. OP was looking for genuine advice, not your constant randomly capitalised drivel. You've clearly said your piece on every single post. We get it - you are far superior to the rest of the world and only your opinion matters. Happy?

        Haven't you got work to do or a brick wall to argue with?

        1. RyokuMas
          Coat

          Re: Any MS devs looked at this?

          @Spiz - Given the length of time we have been putting up with these comments, I'm wondering if they count as breaking the comment guidelines.

          I'm thinking that we're looking at at least 2, 3, 4, 7 and 15...

          1. jake Silver badge
            Pint

            Re: Any MS devs looked at this?

            Translation: MOM! THE BAD MAN IS LAUGHING AT MY TOYS!!! MAKE HIM STOP!!!!!

            1. Geoffrey W

              Re: Any MS devs looked at this?

              Translation: I agree with the bad man, even though we've only ever seen the toys in a shop window while running past and trying not to see the nasty things. Our wooden, hand carved, boring, toys are far superior and so are we...

      2. sabroni Silver badge

        Re: If someone were to offer me a SHIT SANDWICH

        It's Nutella Bob. That's the problem with jumping to conclusions, easy to get it wrong.

    3. ettery

      Re: Any MS devs looked at this?

      Good question @sabroni - lots of haters here. It's clear from the negative posts that many have never tried using the latest MS tools to build for for Linux, and none have persevered. So they are just ill-informed opinion. I see the poeple who have tried it are positive.

      I build and support .NET Core APIs and Apps which all run on Linux, both natively and in containers, and it works brilliantly - easy dev environment which lets you focus on the work and deliver working code. Microsoft's dev tools work well. Yes, Visual Studio doesn't run on Linux, but the deployment is easy. The "friction" is no greater than getting setup with Java (which I also use) - probably less if you take fiddling around with Maven files etc into account.

      And those slating VSCode are stuck in their ways and missing out - what a fantastic tool for just about everything I do. Look at the numbers - fastest growing dev tool by miles for the last few years. Even ignoring it's main focus (node, html, javascript, typescript) - look at the extension installs: 55,000,000 python extensions, 19,000,000 Java, 16,000,000 C# (less than Java! - indicator that Java IDEs are rubbish compared to Visual Studio?) 11,000,000 Go etc. Even if lots of people install extensions and don't use them, those are big numbers. Much of the power of an IDE in the feel of an editor.

      Have fun and don't be put off!

    4. jake Silver badge

      Re: Any MS devs looked at this?

      Sabroni, I hate to burst your bubble (again), but I have never met a Linux developer worth her salt who hates MS stuff before looking at it. After looking at it, certainly. But never before.

      1. Glen 1

        Re: Any MS devs looked at this?

        You've not seen BOB'S posts then?

        Oh, you said "worth [their] salt"

        Nevermind

      2. Geoffrey W

        Re: Any MS devs looked at this?

        Sabroni asked a very reasonable question, seeking reasonable replies. Do you and Bob have no self control or ability to say nothing? It's tiresome and boring and makes you look faintly ridiculous. It's clear you, at least, do have things to offer to the forums from your apparent long experience, but this is not one of them. We all know the views of both of you by now so can we not take it as read that you are going to say this (again...and again) and you just walk on by with a zipped lip.

  8. NerryTutkins

    nice but is it worth it?

    As a long time .NET / SQL dev, i welcome Microsoft's open source direction, and the fact they are supporting linux with both .NET and SQL Server.

    However, I do wonder what the usage is like? We looked at .NET core for a big project we started about 3 years ago. It was RC at the time, and was missing a bunch of things we needed, apparently because implementing them cross platform was harder. Since we were going to use Windows servers anyway, we just opted for tried and tested ASP.NET MVC. Cross platform is nice, but you inevitably have to make compromises in terms of features and/or simplicity as a result. So using a newer platform that had fewer features but was cross platform made no sense when we were going to run it all on Windows anyway.

    I would imagine that the vast majority of people using .NET and SQL are doing so on Windows servers. So I just wonder long term what is in it for Microsoft? Maybe it will change longer term, but there doesn't seem to be an obvious commercial reason for them to push their free wares onto operating systems that could eat into their bottom line selling Windows licenses.

    What is their real motivation for this? Is it really ideological openness, or is there an end destination - use cross platform to increase the footprint of devs and sell them tools? Or is the hope to eventually get these people off of Linux and onto Azure?

    1. Marcelo Rodrigues
      Black Helicopters

      Re: nice but is it worth it?

      What is their real motivation for this? "

      Embrace, extend, extinguish.

      1. Loyal Commenter Silver badge

        Re: nice but is it worth it?

        The "EEE" business model was dropped some time ago when MS realised there is mnuch more money to be made from selling SaaS. If they can proivide Linux VMs in the Azure cloud, then they can charge for them per CPU cycle. If you pay money for MS licensed software, you get the support from MS, if you go for the free option, you don't get much more than the basics. Apart from the potentially eye-watering costs of Azure, it all sounds perfectly fair to me.

    2. chuBb.

      Re: nice but is it worth it?

      It really depends on what your doing, bog standard lob app unless infrastructure costs forces Linux as the server stay all windows

      Web app with nosql and rdms. Net core can work very well especially if say u use redis as a local cache and host on same box as core app

      Really it depends on your devs, if they are die hard orm users (java or. Net devs usually) then they will bitch ef core doesn't have a load of bells and whistles (which cease being a benifit when you have a real dB of several hundred tables and distinct schemas but I digress) for me I like it always hated having control of queries removed from me by most orms especially seizing the brain damage produced when a left outer join and in clause would suffice... Thankfully dapper works great and does the important bit of most orm frameworks mapping objects to columns For me the biggest issue was signalr not being prod ready

    3. Maventi
      Linux

      Re: nice but is it worth it?

      It's because Microsoft understands that 'aaS' offerings are where its bread is buttered now. Linux dominates servers, so much better to properly support that and make buckets of money by hosting it and providing good tools for devs than ignoring it and missing a huge slice of cloud market. Azure would be less than half the size it is now if Microsoft chose to ignore Linux.

  9. Christian Berger

    Why?

    There's Lazarus out there which, as far as I know, can easily interface with MySQL bringing you quick and simple ways to access a database with a GUI. It even compiles to native code, yet offers you array and integer bounds checking if you want to enable them. It's even cross platform as you can just re-compile your application to make it run on Linux, MacOSX or even Windows.

  10. Anonymous Coward
    Anonymous Coward

    Production .Net Core is pretty good

    I've done many servers (on AWS, Scaleway, Digital Ocean and others) with .Net Core apps and they've given great performance. Memory overhead is about double some of the alternatives, but it doesn't keep growing like some others; it's resource requirements (for good codebases) stay pretty stable.

    As for development, I use VS Code on Pop!_OS or Mint. There is zero friction. One plugin, and that is (a) from Microsoft themselves and (b) offered to you the moment you open a C# file or solution/project. And debugging just works.

    Seriously, there is less effort "configuring third party plugins" in VS Code than there is in choosing a colour theme in your Terminal of choice. It even has Git support built in.

    If you check it out and it isn't for you then great, there are a load of alternatives. To dismiss it without checking it out, especially given it's rapid iteration over the last few years, is just unprofessional (unless you have corporate constraints or similar of course). Even some of the refactorings (renames, redundant usings etc) work as well as Visual Studio.

    As I say there is an increased resource usage. But the low friction development, high-developer-throughput language that is C#, and masses of online documentation make it a very productive experience (and my time costs a lot more money than doubling the server RAM).

    1. PM.

      Re: Production .Net Core is pretty good

      Thanks for valuable and informative comment !

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like