Live data from Hacker News

Building .NET projects is a world of pain and here's how we should solve it

blog.maartenballiauw.be

41–49 of 49 posts

Re: Building .NET projects is a world of pain and here's how we should solve it

#41
post #20

Building .Net projects cannot really be solved in a way that compares well with nix systems. - Windows had no programmability until recently with Powershell. On Linux, I can script literally everything from database installs to component updates. - Powershell. Unfortunately they got their design wrong. Unix is a text and file based OS; you can script any server configuration with tools like awk. Windows apps doesn't…

>Unix is a text and file based OS; you can script any server configuration with tools like awk. Windows apps doesn't have such a concept. Why is this a problem? Why would I want to use awk when I can use the powershell object pipeline? Do you even know how powershell works?

One problem with powershell is that it's ridiculously slow compared to bash, and the utilities it calls are often extremely heavy compared to unix variants.

Bash (etc) work by passing things around between processes - and there can be many of these processes in a complex shell script, possibly hundreds in parallel, or many more after each other (ever done an `xargs -n 1`?) Of course, that's only ever going to work if each process is fairly light.

As a world-encompassing scripting tool, powershell is also process based. However, it's also .NET based, and many of the sub-processes (such as new powershells or "small" scripts) are themselves implemented in .NET. However, .NET is not a lightweight VM, and many process allocate quite a bit of memory. No OS deals graciously with out-of-memory, but windows is particularly bad - allocated but unused memory must be pagefile backed, so heavy processes cause swap grinding pretty easily. (Linux tries to pretend it has memory until it's written, then kills random stuff).

Another fairly specific problem is that the .NET Regex engine is terrifying slow compared to grep; it uses a backtracking potentially exponential algorithm. Searching and extracting text from files (e.g. logfiles) is a fairly common shell task, so this is a problem. In all fairness, if you're not generating regexes programmatically, and you know the pitfalls, and you can spend time tuning problematic regexes, it's not too hard to work around (but that's still a hassle and a waste of time).

Both of these problems have bitten me in practice. I've had machines start swapping so badly that before you really notice what's going on the mouse cursor freezes (when the OS updates the mouse cursor once a minute, you know you're screwed). I've also have real out-of-memory moments with sudden lockups+bluescreens. Similarly, I've had log-parses take hopelessly long due to the poor regex implementation.

For simple orchestration, powershell isn't too bad, but that's just a subset of what shell-scripting is used for in unix.

Personally, I've got a few CLR helpers and just write scripts in F# or C# now. The regex implementation is no better, of course, but with a "real" language you tend not to rely on regexes quite as heavily since you've got easier access to other tools. And as to performance - if your subscripts are largely .NET themselves, you can stay inside one instance of the CLR the overhead of another thread/task is negligible.

Re: Building .NET projects is a world of pain and here's how we should solve it

#42

If you have a couple minutes, take a look inside any of the Microsoft-shipped .targets file to see the mess in its full glory. That's programming in XML, kids. It boggles my mind why Microsoft went the XML route when designing MSBuild (apparently they were copying NAnt and various other "enterprise-grade" build systems from the Java world), but it would be _so much_ better if they created a special DSL for this parti…

I completely agree. Terrible stuff.

It gets even worse with TFS and its new workflow system. In fact workflow in general is terrible and once again it's ' programming in XML'. Do MS dogfood this stuff at all?

Re: Building .NET projects is a world of pain and here's how we should solve it

#43
post #9

I'm not really sure what point you're trying to make. This seems to be exactly where MS are moving to with nuget. Like all the new stuff, the WebAPIs, EF 6, OData, etc. is now being published as NuGet packages instead of installers or SDKs or whatever. NuGet seems to be a direct response to this very issue and you constantly mention it. So what are you asking? After all they can't change the past!

Microsoft is increasingly doing it with their frameworks and components, but not for real SDKs. Windows 8 and Phone development still requires an installer to build. It's not just Microsoft though. Other vendors need to jump on the same bandwagon. Right now, almost nobody really does, definitely nobody who sells to the enterprise market.

https://www.nuget.org/packages/AWSSDK/

https://www.nuget.org/packages/Box.V2/

https://www.nuget.org/packages/DeveloperForce.Common/

https://www.nuget.org/packages/Atlassian.SDK/3.0.0-beta1

Random enterprise names I picked out off the top of my head.

Re: Building .NET projects is a world of pain and here's how we should solve it

#44

If you have a couple minutes, take a look inside any of the Microsoft-shipped .targets file to see the mess in its full glory. That's programming in XML, kids. It boggles my mind why Microsoft went the XML route when designing MSBuild (apparently they were copying NAnt and various other "enterprise-grade" build systems from the Java world), but it would be _so much_ better if they created a special DSL for this parti…

Considering there's a move in the Java world to Gradle, a DSL approach, yeah... MS could have jumped to the head of the class by avoiding this XML years ago and put more forward-thinking effort in this area.

But... this isn't a new criticism of MS. In most areas, they simply adapt to what the prevailing trend is.

Re: Building .NET projects is a world of pain and here's how we should solve it

#45
post #37

Not that I'm really against this article, but psake ( https://github.com/psake/psake ) is a more realistic end-goal to handle the kind of flexibility you really need in projects. (It's accomplishable through MSBuild pre/post actions, but those are murder to edit anywhere but Visual Studio.) The problem with it, which is potentially a big one, is that psake uses PowerShell, and is therefore Windows-only. I'm hopeful t…

If you want to run on both Windows and UNIX-style systems, try FAKE ( https://github.com/fsharp/FAKE ). It's rapidly becoming a popular choice for building all sorts of .NET projects. Scott Hanselman recently covered it on his blog: http://www.hanselman.com/blog/ExploringFAKEAnFBuildSystemFor...

Or use Rake with Albacore, a Windows/MSBuild plugin for Rake, and be done with it.

Re: Building .NET projects is a world of pain and here's how we should solve it

#46
The biggest offender for me, besides nuget being pretty much useless for real work, is that you need to install Visual Studio to automate headless ASP.NET builds! That's insane. Even the simplest most barebones ASP project requires it. As a result, our Chef scripts include downloading and installing a bunch of MSIs from S3. I would love to be proven wrong.

Re: Building .NET projects is a world of pain and here's how we should solve it

#47
post #9

Earlier quoted context omitted.

Microsoft is increasingly doing it with their frameworks and components, but not for real SDKs. Windows 8 and Phone development still requires an installer to build. It's not just Microsoft though. Other vendors need to jump on the same bandwagon. Right now, almost nobody really does, definitely nobody who sells to the enterprise market.

https://www.nuget.org/packages/AWSSDK/ https://www.nuget.org/packages/Box.V2/ https://www.nuget.org/packages/DeveloperForce.Common/ https://www.nuget.org/packages/Atlassian.SDK/3.0.0-beta1 Random enterprise names I picked out off the top of my head.

Okay, valid point, some already do. But that doesn't change the case that _all_ of them should be doing it whenever possible.

Re: Building .NET projects is a world of pain and here's how we should solve it

#48

It's just a different bag of hurt but no more so than node or ruby. Setting up ruby boxes makes me homicidal, whereas .net feels like nothing. But then I have much more experience with the latter, and 'evolved' with it and it's precursors. That said, building .net is relatively trivial and it's tools are caught up. I think what he's looking for is http://fsharp.github.io/FAKE/

After 7 years of setting up ruby servers, I can't say it's ever made me homicidal. RVM and rbenv on multiple different distributions have generally all been fine. What did your distro/environment look like?
Post reply on HN