views:

38

answers:

3

Hello,

Visual Studio 2008 uses its own solution file format, and different build systems like NAnt (and even some complex MSBuild cases) use their own. How do you keep them synchronized? Are there any best practices about doing so? Any automated scripts, plugins...?

Is it viable not to build projects under VS and use only external build system?

A: 

Wait, your doing it wrong;) VS uses SLN file format to determine the VS solution settings (xml), nAnt is a build system uses BUILD file format (xml) to determine the build tasks, it's not a solution. MSbuild uses PROJ files (xml) to determine build process and tasks. What do you mean by "synchronized"? In my case if there are some major changes in the project I've just edit those build files (we're using nAnt, msbuild, etc) and add a proper change.

Leszek Wachowicz
Well, I'm still new to the world of MS development (I usually code on Linux, where one `make` is usually enough to express solutions, projects, single compilation units, deployments and so on) and I'm still trying to understand it. So you are still using VS/MSBuild for compilation, and keep NAnt scripts side by side. Whenever there is a change in one of them, a change to the other one must be done manually?
liori
A: 

Using NAnt to manage your build dependencies and projects is indeed troublesome since you need to maintain the dependencies in both the build script and the solution file. The usual thing is simply to ensure developers update the build scripts as they add/remove projects to the solutions and make sure you have sufficient automated smoke tests that you'll spot when expected pieces haven't been added.

It wouldn't be difficult to write a tool to parse the solution file and work out the project dependencies, but I'm not aware of any that already exist.

Note that MSBuild is what VS uses internally and it can accept a solution file as an argument if you run it externally, it will generate an equivalent MSBuild script from the .sln and execute it (you'll see a .sln.cache file appear).

Paolo
A: 

Paolo's answer points to the right direction: Visual Studio creates .sln files, MSBuild can process these solution files and with NAntContrib's msbuild task you can call MSBuild from NAnt scripts easily.

The Chairman
But then you cannot use NAnt-specific features inside the build? And then there is no point using NAnt at all, if you reduce it to call MSBuild?
liori
Got something in mind? MSBuild is actually pretty good and it's very easy to write extension tasks (there's also an extension pack and community task set you can google for). I've not personally found anything that NAnt can do that MSBuild can't.
Paolo
No. Many comments on this site say that NAnt has more features... but I haven't studied them yet. I'm mostly trying to understand how people use NAnt with VS.
liori