Building NHibernate 1.2.1GA on .NET 3.5
I recently reached a point where for reasons that I'm sure you can all relate to, I decided to clean my laptop and rebuild. I therefore did a clean install of Vista with SP1. As a quick aside, SP1 does actually seem to improve performance - particularly when starting up or closing down. Anyway, after I was back up and going again, I setup NAnt and then downloaded the NHibernate 1.2.1 GA source. However, I ran into 2 major problems building, so I thought I would share those, along with how to work around them.
Both problems can be corrected by modifying the markup in the build-common/common.xml file.
The first problem had to do with the fact that the build was expecting the clover library. The solution was simply to add a condition to the property set declaration. I'm not going to spend any more time on this one, because the problem/solution is documented here.
The second problem is that there is no target in the build file for .NET 3.5. On most machines, this isn't a big deal because you've probably upgraded framework versions incrementally, and the build file can target 2.0 with no problem. Because I have a fresh OS/Framework install, I got an error saying that .NET 3.5 is not supported for my build of NHibernate. This can be worked around by adding a target declaring a configuration for .NET 3.5, like so:
<target name="set-net-3.5-framework-configuration">
<property name="nant.settings.currentframework" value="net-2.0" />
<property name="current.build.defines" value="${build.defines}NET,NET_2_0" />
<!-- not using SDK_v2_0 because ndoc throws an exception -->
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="merge.targetplatform" value="v2.0" />
</target>
When you get into the config file, you'll see that all I did was create a target with 3.5 declared as a part of the target name, and then coped the body from the 2.0 target inside of my 3.5 target. Initially, I had actually configured the properties to make them specific to .NET 3.5. Unfortunately, I later discovered when I tried to use the compiled assemblies that many of the source files have preprocessing directives that are specific to the defines declared in the build properties. For example, the ISet<T> source code is wrapped with the following directive.
#if NET_2_0
Anways, after making these 2 changes, I was able to build with no problem, and NHibernate continued to work as advertised.
I am currently the Editor-in-Chief for MSDN Magazine. I joined Microsoft in 2006 as a product planner with the certification team at Microsoft Learning. Prior to that, I spent my career as a developer and later as an architect. My main technology passions include pretty much anything on language theory, agile development, and service-oriented architecture.