I have said it before and I will continue to push my theory that the next big problem area will be in configurations. The environment variables are an old habit, used extensively by the java framework but it also makes ripples in the Microsoft build environment.
I just spent some time introducing TeamCity continuous integration and build system to a company. It’s an excellent product from JetBrains that I can truly recommend. Comparing Cruise Control with TeamCity is like comparing notepad with Visual Studio. All can be done but not without inflicting pain.
Normally, setting up a new project build and test is a child’s play in TeamCity, but not this time. Apart from a few hurdles regarding subversion access and some cumbersome handling of references in the solutions there was a more evil and nasty problem.
At each build we were getting a MSB4126: “Release|BWS” configuration invalid. I searched sifted through tons of config files, project and solutions with no luck. Finally I fond the problem, it was in the environment variable Platform. For some reason this variable was set to BWS. I still have no explanation on to what BWS means (other than Beer Whine and Spirituous) and why it was set. I removed it and the system runs without a problem. After that little fix the builds executed like a charm.
The root of this problem is actually that MSBuild tries to be smart, looking at the Platform environment variable and adding what’s in it to the build. But why should it try this, what other configuration sources should I be aware of that can inflict strange behavior on my set-up? And in the name of flexibility and choice we add to this mess of configuration, every part of the system should be configurable, its always in one of the constricts of every project to day. Never hard code, always provide flexibility.
The problem is that leads paralysis as in Paradox of choice, and the way out of this is to step back, look around and start setting up some boundaries for choice. That we offer flexibility with a great sense of responsibility, and stick to a well established default behavior.