CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

Get a Build Server and Keep it Clean

The importance of a clean build server was reinforced for me this morning.  We're getting ready to wrap up our first demonstration of our executable for users in a different timezone in London.  Everything is wonderful on our developer workstations, but not so good on a clean box.  It's the normal culprit, a 3rd party control library needs some licensing info embedded into an assembly or has to be installed or something else.  We found the problem easy enough before it hit the end users because we run the client on our build box that doesn't have Visual Studio or the control libraries installed into the GAC.  A clean build server finds these problems for you fast so the customer or testers don't.  Whatever you do, don't put Visual Studio on your build box because it can fool you into thinking your installation script is complete when it only really works because of the assemblies that VS GAC's for you.



Comments

Jay Flowers said:

So I don't follow you.  

When does, Which ones does, Why does: VS put assemblies into the GAC for me?  

# April 26, 2007 1:32 PM

Jeremy D. Miller said:

Jay,

The immediate example that came to my mind is Crystal reports that gets installed with VS.  Think about 3rd party control libraries that you install that put stuff in the GAC.  The code will work on your own box just fine, but simply doing an XCopy from the bin/debug or bin/release folder isn't good enough anymore because the build server won't necessarily have those assemblies in its GAC.

It basically points out the places where you need to add things to your build and deployment scripts on clean boxes.

Does that help?

# April 26, 2007 1:48 PM

Jay Flowers said:

Ahh I did not think about the Third Party stuff that comes bundled with VS.  I have never installed any of that stuff as I have never needed it.

I was concerned that VS, not the installer, was going and putting stuff in the GAC.

# April 26, 2007 1:57 PM

cmyers said:

Jeremy, you've done several "Thou shalt..." posts like this. You should compile them into some type of permanent artifact (can you do that on codebetter.com?) and call it something like 'Jeremy's Umpteen Commandments'.

Here's today's addition:

IV. Thou shalt remember the Build Server, and keep it holy.

# April 26, 2007 5:06 PM

ralfkret said:

Yes you are right. One more reason one shall not use MSTest for unit testing. An installation of VS is required on the build box - eehhh and maybe a licence as well.

# April 27, 2007 4:21 AM

Jeremy D. Miller said:

Ralf,

You're kidding, right?  I thought there was an executable as part of MSBuild for MSTest.  It's not the end of the world, but you're right that it's one more little reason to stick to the OSS stack.

# April 27, 2007 5:57 AM

Joshua Flanagan said:

No, unfortunately, he is not kidding. In order to run MSTest, you need Visual Studio on the build server. In order to run Code Analysis (formerly FxCop), you need Visual Studio on the build server. In order to check code out of TFS, you need Visual Studio on the build server. Its mind boggling, really. They come out with MSBuild with the great pitch "you can now compile your projects without Visual Studio", and in the same release they throw in all this extra stuff that DOES require Visual Studio.

Now, to be completely honest, none of this is REALLY true. You can hack around with the default MSBuild targets files, find the correct EXEs (MSTest, FxCop) and assemblies (TFS client) on a machine where VS is installed, and include them in a tools folder of you source code repository, just as you would with nunit.exe. You can then run all that stuff on your build server, without VS. But that is completely undocumented (though, I have a half-finished blog post on it), and probably illegal (license violation).

# April 27, 2007 9:31 AM

Jeremy D. Miller said:

Josh,

That whole paragraph is an awfully good argument for me on keeping the NAnt stack alive and kicking.  There's just so much advantage in having tools that were written by the developers who use them versus having tool developers write tools that they don't use themselves.

# April 27, 2007 9:45 AM

Joshua Flanagan said:

Absolutely. The reason my blog post on how to get around it is "half finished" is that I eventually decided all the hassle wasn't worth it, and reverted to the open source tools. I'd rather encourage others to do the same, rather than tell people how to keep fighting Microsoft's tools.

# April 27, 2007 3:58 PM

Mary said:

do you build on a visual studio 2005 and then rebuild it using msbuild on a build machine or what is the recommended process?

THank you

# June 9, 2007 12:02 PM

Jeremy D. Miller said:

@Mary,

One way or another, you want the "official, to be deployed into production" builds done anywhere but a developer workstation, preferably by checking out the correct version from source control and building on the spot.  If you build directly in Visual Studio you're effectively compromising your source control management and opening the door for a host of problems because it's very easy to miss code on a developer workstation that isn't checked in yet.  

The teams I've worked on for the last 4 years have used Continuous Integration systems with CruiseControl.Net & NAnt or MSBuild.  When it's time to ship or deploy to a testing server, I just take the latest build on the build server.

# June 10, 2007 8:53 AM

Jeff Dickey said:

Jeremy,

I think you're absolutely right with both the "so much advantage" and "anywhere but a developer workstation" comments. Microsoft have been very, very good to me all through my career, but even when I'm hired by folks who run all- or nearly all-Windows shops, I find myself using Microsoft tools less and less, for exactly these reasons. (Having shifted to about 80% Web development helps, too.)

Microsoft have just completely lost sight of what it's like to develop anything better than bare-minimum-mediocre software in an environment where the end users (and testers, and etc.) are running significantly different (cleaner) systems than the developers. If all the developers have all the Office and (Microsoft) business apps on their systems, and all the end users have full VS-and-kitchen-sink stacks on theirs, this problem goes away (and Microsoft gets more money, of course).

But sooner or later Microsoft are going to have to get past the Jerry Michalski model of customers-as-consumers. As developers, we should have a reflexive impulse to eliminate dependencies EXCEPT where the gain from including a dependency decisively outweighs the pain of managing the dependency AND at the same time is greater than what could be accomplished in the given situation without that dependency.

We've still got a long, long way to go before the development process resembles engineering more than (honest) craftwork.

# May 11, 2008 12:18 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Jeremy D. Miller

Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy previously worked as a systems architect building mission critical supply chain software for a Fortune 100 company and learned agile development practices as a .Net consultant at ThoughtWorks, one of the pioneers of agile development. Jeremy is the author of the open source StructureMap (http://structuremap.sourceforge.net) tool for Dependency Injection with .Net and the forthcoming StoryTeller (http://storyteller.tigris.org) tool for supercharged FIT testing in .Net. Jeremy's thoughts on just about everything software related can be found on his weblog "The Shade Tree Developer" at http://codebetter.com/blogs/jeremy.miller, part of the popular CodeBetter site. Jeremy is a Microsoft MVP for C#. Check out Devlicio.us!

Our Sponsors

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP