Wanted to get some thoughts on how to address some issues I'm having with creating an automated build (with NAnt). The build file calls msbuild against the .sln file and some of the issues could possibly be resolved if I instead called csc.exe directly and compiled everything into a single assembly.Here is the task that compiles (for reference):<target name="compile" depends="init">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline="${solution.file} /t:Clean /p:Configuration=${project.config};SolutionDir=${current.dir} /v:q" workingdir="." />
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline="${solution.file} /t:Rebuild /p:Configuration=${project.config};SolutionDir=${current.dir} /v:q" workingdir="." />
</target>
The first issue I had was that it couldn't find project references. This was a strange one. I had to drop and re-add all the project references to get it to work. The issue was that the GUIDs for the projects didn't match. For example, the Data project had a reference to the Core project. In the .csproj file, the ItemGroup was referencing the Core project but the GUID didn't match. Perhaps that's a side effect of the scaffolding but the question is: If msbuild can't find the references, how does Visual Studio do it? I thought VS just called out to msbuild.
The second problem is one I'm currently trying to work out. The Tests project uses its own NHibernate config file to do tests against an in-memory database. But the mapping integration tests use the same config file as the web application. During my build, I'm dumping everything into a single directory and performing the tests there. Which is an issue because I need to reference two different config files. Plus there's the fact that the integration test has a hard-coded path to the Web project's config file.There are a couple of ways i can think of that could fix this. One is to have a separate project for unit tests and integration tests. Another is to create the NHibernate configuration programmatically for the SQLite tests (as shown here: http://ayende.com/Blog/archive/2006/10/14/UnitTestingWithNHibernateActiveRecord.aspx).
And the over-arching question: is this a S#arp issue or an individual project issue? I.e. Should S#arp be changed so that the NHibernate configuration is managed by a separate component? One that either reads from a file or has it done programmatically? At first glance, that seems like overkill but maybe not.
Interesting….I haven’t had any problems on my projects in these last months. I’m using cc.net and I’m using msbuild directly against the sln file without any problems regarding dependencies (I’m talking about solutions that have several projects, none of which is a MVC web project). If I recall correctly, the only problem I had was that by default I was getting msbuild from .net 2.0 instead of the on from 3.5…
Regarding the NH configuration, I’ve used both approaches and now I try to stick with the code approach….
---
Luis Abreu