views:

479

answers:

1

Sorry for being somewhat vague but so is the project I'm leading now. I inherited a large body of various in-house tools and am trying to put unified build system around each one.Some of the projects we have (few dozen) are .NET-based web-projects C# mostly, some of these are web-services and some webapps. The apps were build over past 6 years so .NET version varies from 2 to 3.5. The worst part - all of the apps were build using VS and none has command-line builds.

The requirement is: I should be able to check out code from SVN and fully build any or all of the projects completely from the command-line with no input prompts so it can be eventually integrated into TeamCity (continuous integration tool)

I have C/C++, Java background so I did a little research and everything seems to be pointing to MSBuild as a tool. Now for the past 2 weeks all I hear from our .NET developers: "It's hard, it's impossible, we don't know how to do it" So here now come the questions:

  1. Is it possible to retrofit any existing .Net project with command-line only build? If there are limitation what would those be?
  2. Do I need a full-blown version of VS to perform the build and deployment or is there some smaller alternative (Again, eventually projects will be build on continuous integration box with no GUI)
  3. Can I check out code (from SVN) into any directory? Currently I've been told that I need to put code into "special location" configured to be "monitored" by VS
  4. How to manage external dependencies? Currently I'm hearing from the team that any 3rd party libraries needs to be "pre-installed" prior to the build using UI and the best solution I've been offered by team is to "install and create a VM"

Your suggestions will be much appreciated

+1  A: 

It depends on exactly what your dependencies are and things, but:

  • MSBuild is what Visual Studio 2005 and later uses as its "native" file format - so you can build either a VS solution or a VS project pretty easily
  • MSBuild is part of the .NET framework, along with the various compilers. You shouldn't need to install VS.
  • Yes, you can check out code from SVN anywhere. It's not like VSS/VSTS where the server "knows" where the code is
  • External dependencies should - wherever possible - be DLLs just stored in source control and referenced via relative paths. If you've got something you have to install in the GAC, that's slightly harder.

Personally I've had success using NAnt as the build "controller" but then shelling out to MSBuild to do the actual compilation bits. It's nicer (IMO) than MSBuild for the controller bits, but not as good at doing actual compilation as it hasn't kept up with Visual Studio.

You can see an example of how this works in my Protocol Buffers port.

Jon Skeet
I'm using Maven (exec-maven-plugin) to call MSBuild with various switches. I also can use Maven to grab DLLs and put them under the project's folders (say proj/lib). How do I "activate" these? Is there some MSBuild commands that would help?
DroidIn.net
BTW if MSBuild uses VS solution files can I still check out the solution and build it with .NET framework only without actually installing VS?
DroidIn.net
There's no need to "activate" the libraries so long as they're referenced appropriately from the VS projects. And yes, you can still build without installing VS.
Jon Skeet
Jon, can you define "appropriately referenced"? I'm pulling source into some directory and the only thing I can predefine is a relative path - will that be sufficient? And if not - can I register DLL at runtime using MSBuild?
DroidIn.net
"And yes, you can still build without installing VS" ... as long as you don't want to build a Setup project (to generate an MSI) - this needs VS :(
Joe
@Joe: Good point. It sounds like they're server-side apps rather than client-side, so hopefully installers won't be an issue.
Jon Skeet
@DroidIn.net: I mean if they're references specified in the project file as a relative path, instead of relying on the dependency being in the GAC.
Jon Skeet