views:

324

answers:

1

We're in the process of streamlining/automating build, integration and unit testing as well as deployment. Our software is developed in Visual Studio where we have use both C# and VB.NET in our projects. A single project can be contained within multiple solutions (i.e. Utils project is used in both ProductA and ProductB solutions)

For historical reasons our code repository isn't as well structured as one could have hoped for. E.g. Utils project might be located under ProductA solution (because that's were it was first used) but it was later deemed useful for productB development and merely just included into the solution of productB (but still located in a subdirectory of productA).

I would like to use continous integration testing and have setup a CC.NET build server where I intend to use NAnt for creating the actual builds.

Question 1: How should I structure my builds on the buildserver? Should I instruct CC.NET to retrieve all the projects for productB into a single library e.g. a file structure similar to

-ProductB
--Utils
--BetterUtils
--Data

or should I opt for a filestructure similar to this

-ProductA
--Utils

-ProductB
--BetterUtils
--Data

and then just have the NAnt build scripts handle the references? Our references in VS doesn't match the actual location in the code repository so it's not possible today to just check-out productB solution and build it straight away (unfortunately). I hope this question makes sense?

Question 2: Is it better to check out all the source code located in different projects into a single file folder (whilst retaining some kind of structure) and then build every thing at once or have multiple projects in CC.NET and then let the CC.NET server handle dependencies? Example: Should I have a seperate project in CC.NET for monitoring the automated build/test of Utils project when it's never released on it's own? Or should I just build/test it whilst building it as part of ProductB?

I hope the above makes sense and that you can provide me with some arguments for using either option. We're nowhere near an ideal source code repository structure and I would prefer if I can resolve the lack of repository structure on the build server instead of having to clean up the structure of our repository. Switching away from VSS is (unfortunately) not an option.

Right now our build consists of either deploying via VS clickonce or pressing F5 so just getting the build automated would be a huge step up for us.

Thanks

A: 

To answer your first question, I would recommend a separate top-level folder for each build project. The problem with having a single tree matching your source repository is that when your build server is trying to run multiple builds at once, one or more will likely fail due to files in use by other processes. Also, you may run into cases where a build script is pulling an older version of the code. In that instance you don't want a different project to accidentally use the incorrect source version.

If your solutions already reference projects from relative paths, you may end up with a structure like this:

-CCNetBuilds
--ProductASource
---Utils
---...
--ProductBSource
---ProductA
----Utils
---ProductB
----BetterUtils
----Data

In this case, the build for Product B contains part of the Product A source, at the same relative path as your solution already expects. This takes a bit more time to set up in CC.Net, but makes it easier to maintain if the developers have their code set up this way on their machines. The same solution files used in development are used by the build server.

To answer your second question, I prefer Utilities being its own build. If I have unit tests on my Utilities assembly, I would not want them to run for every single product that uses the Utilities. Also, if you have a separate build for Utilities, you can set a dependency in CC.Net so that Product A and B will not attempt to build if the Utilities build is broken. This provides a bit faster feedback that something is wrong.

Pedro
I did some experimenting with your suggestion and it seems to be the right way. I'm still setting up NAnt scripts to run the builds but using the actual solution file of the project to run the build via the MSBuild task of Nant. I'm also going to adopt the relative references that you suggest although this will add a lot of extra directories. I believe the isolation is important though.We will most likely be switching to TFS2008 come march and I hope these efforts of setting up a build server won't be wasted. Thank you for your help.
llykke