Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hoo boy, MSBuild was always by far my least-favorite part of being a .NET developer. I would like to flippantly say they should just throw it away and replace it, but probably much too late for that.


I have no strong opinions for or against MSBuild. What is it that you dislike about it? Or what is it that other tools do that MSBuild fails to do?

PS - I have done a lot of .Net development, but rarely did anything beyond the basics with MSBuild directly (mostly via Visual Studio, or took the pre-generated command line and stuck in a script).


I really hated the language you use to describe build tasks. It is a very frustrating mix of declarative and imperative syntax. And of course, who wouldn't want to write code in XML?! (XML, the markup language, the one we use for marking up information like documents and records.)

I was doing fairly complicated tasks with it years ago, and it's just one of those technologies that feels like it is fighting you at every turn. This was for continuous integration stuff and developer-productivity tools, not "open up Visual Studio and click the button". Thankfully much of that has been obviated over the years by things like NuGet and Octopus coming around.


> I really hated the language you use to describe build tasks.

Yup. For some reason that escapes rationality, MS chose to control the build through Workflow Foundation. And they build a horribly complicated WF "script". Pretty much universally hated.

But you may be pleased to know that they have now abandoned that, and each build task can now be described pretty much by the scripting language of your choosing.


Ah, that is nice. .NET seems to have a wonderful property where even if they start out with something dumb, they eventually come to their senses and do the right thing. Sure can take a while to get there, though.


I am starting to notice a few (mostly cross-platform) projects writing sln/vcproj files using CMake now, so that might be an alternative.


cmake is certainly worth looking at. Doesn't take much to get up and running with it, it's pretty straightforward to use once you're set up, it takes out-of-source builds seriously, and it's got fair support for adding custom build tools (something you'll have a devil of a time getting working nicely in Visual Studio). Reasonable ecosystem as well, with a good supply of online examples and drop-in helper scripts for locating common libraries. (Compare and contrast to, e.g., MSBuild, boost jam, or JamPlus - all of which, even MSBuild, might as well by comparison have about 0 users each.)

Not to say that it isn't awful in many respects, though. It often feels as if it has been designed by 3 people, none of whom talk to one another, and all of whom have different ideas about how things should work. For every time there's some easy setting that nicely handles every platform for you there's another where you have to carefully distinguish between VC++/gcc/clang/etc. and add compiler-specific flags to some random string. And the scripting "language" is unhinged.

Still - compared to a normal project that targets N platforms, where you might well have to deal with N build systems, all appalling, if you use cmake, you'll only have to deal with one.


I dislike maven for the same reason, but maven at least seems to have reasonable build structure.


Maven at least uses a declarative syntax, which is a sensible use of XML. Personally, I'd prefer JSON, but I've seen much worse use of XML.

Imperative XML makes me choke.


I hated it too. I don't recall a single good moment about using MSBuild. I never once felt like I'd figured it out, nor that I was getting to grips with it. But perhaps its brilliance was just beyond my ken.

It was astoundingly verbose, rather poorly documented (I didn't think much of the official book either), extremely short on any kind of examples that might be usable with slight tweaks when you're getting started, and seemed to make unnecessarily heavy weather out of the simplest of tasks. Your debugging options are rather limited (especially if something goes wrong in one of your DLLs!), and I for one found the log files very hard to read.

(On more than four occasions, I also lost a lot of source files after doing a build|clean. I never managed to finger MSBuild for this directly, but there aren't that many programs that are invoked on build|clean, and fewer yet that rely a filing system watcher to tell them which to delete, so I know where my suspicions lie.)

I also have vague memories of finding out that only certain constructs could be made conditional, and that there were no facilities for abstracting conditions, making some of my files very repetitive and long-winded - but to be honest, at this point, I've blanked most of it.


> PS - I have done a lot of .Net development, but rarely did anything beyond the basics with MSBuild directly (mostly via Visual Studio, or took the pre-generated command line and stuck in a script).

This is an excellent reason to avoid MSBuild. IDE lockin is a nightmare.

Might be unavoidable for Visual Studio, though.


If your priority is avoiding IDE lock-in and you have somehow ended up a Microsoft developer, you need to closely re-evaluate your life choices.


It depends what you're doing.

If you're making libraries, console applications or doing modern websites it's pretty easy to get your build working without Visual Studio.

One - ELEPHANT SIZE - problem is that for some reason Microsoft only ship the Windows SDKs as part of Visual Studio. Meaning that you'll need to install the IDE at least once to get a build running (you can copy the SDKs around after that).

Microsofties - I know that a lot of dev-div people will be reading - can you shed some light on this situation? What's the reasoning behind not shipping the SDKs separately. I've never had this problem with Java..


FWIW, you can install MSBuild without Visual Studio. It's part of the Windows SDK. If your target system is not supported, you have to run it on a supported system and choose the "Download for installation on a separate computer" option. Then copy the resulting msi and cab files to the server and run them. See http://stackoverflow.com/questions/12944502/build-asp-net-4-...

However, after I did this, I had to find build targets that Visual Studio installed and copy them from my workstation into the same directory on the server (i.e. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications).


Yup, that's how I make a build server: clean windows image, MSBuild, then copy the utils, build targets, reference assemblies etc over from a machine containing VS.

It's such a pain that a famous ex-Microsoftie started a connect request for it:

https://visualstudio.uservoice.com/forums/121579-visual-stud...


This works fine until you have to build a project with a 3rd party commercial library requiring licenses (.licx files). I just spent a week trying to put together a vagrant vm to build such a project finally giving up and adding visual studio to its provisioning script.


Do you mean this[1] Windows SDK?

[1] https://dev.windows.com/en-us/downloads/windows-10-sdk


Fantastic, I hope they keep it up :) Previous SDKs have taken a long time to appear outside of VS :(


The SDK has been shipped separately for ages.


With Windows 8 and 8.1 it took a long time for them to be released. Looks like that has been solved now.


Cmake will produce files that msbuild can operate on.


It's not Maven.


Fork it and change it to your taste! Welcome to open source.


They didn't want to change it. They wanted to throw it away and replace it. Not exactly a fork.


Eh, I write JavaScript now.


Reimplement it on Node.js to compete with Grunt and Gulp.


:) Who needs all those silly things, who can even keep track of them all? npm scripts + browserify does the trick nicely.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: