Robert Hurlbut Blog

Thoughts on Software Security, Software Architecture, Software Development, and Agility

NAnt experiences and questions

Sunday, December 7, 2003 Comments

 .NET  ArchitecturePatterns  COMPlus EnterpriseServices  Extreme Programming 
Share:   Share on LinkedIn    Share on Twitter    Share on Google+    Share on Facebook   

As Sammentioned, I have converted our projects from using VS.Net 2003 as the build tool to NAnt as the build tool for all our Distributed .Net projects.  (I mentioned this task way back in late October, and finally got a chance to do it.)

I am using the latest NAnt 0.84 Release Candidate 1, and I am already making changes to my build scripts from last week because of deprecated properties in the 0.83 version.

I have a few questions though, and so far, I haven't been able to find any good answers.   One assembly I am referencing for our builds is the Oracle Data Provider for .Net, which is GAC'd as Oracle.DataAccess.  I would like to refer to this assembly by the assembly name, but so far, I can only get my project to compile successfully if I point to the explicit file name/location.  That file location may be different depending on the machine the build scripts will reside.  Any ideas on how to set this up correctly?  Is it possible to reference a GAC'd assembly? 

I have also tried to use the “gac” task to uninstall and install my GAC'd assemblies for prebuild/postbuild targets.  This seems to work great for installing, but when I use [ gac assembly=“AssemblyName.dll” uninstall=”true” /]  (per the documentation, replace [] with angle brackets), the assembly is re-installed rather than uninstalled.  For now, I have removed the prebuild/postbuild targets and placed them into a script file/batch file.  Not the best solution, but it works for now because is not a completed task for NAnt yet, and I have to do a gacutil and regsvcs for any COMPlus/Enterprise Services components.  Any clues on what I am missing regarding the “gac“ task, though?  Is there a setting, perhaps, in the NAnt.exe.config file?  Update:  Actually, the “gac“ task is part of NAnt Contrib, which is a set of tasks that have not been placed into NAnt yet, or don't belong in NAnt.  NAnt Contrib is now a separate install from NAnt starting with the 0.84 Release Candidate 1.

Update 2:  I found my own error.  The correct syntax is:  [ gac  assembly=“AssemblyName.dll“ action=“uninstall“ ] (replace [] with angle brackets).   To install, use “install“ for the action.  Now, I can place this back into my build scripts.

Update 3:  I found that the “regsvcs“ task IS now part of the 0.84 release.  Great!  Scripts have been updated.

Speaking of the NAnt.exe.config file, according to the documentation, NAnt should use the 1.0 Framework by default, unless it finds both 1.0 and 1.1, in which case it uses 1.1.  I am testing the latest NAnt scripts on my Windows Server 2003, and it does not have 1.0 installed.  Instead of using 1.1, it tried to run csc.exe from the 1.0 Framework directory.  By changing the default Framework version in the NAnt.exe config file to use 1.1, everything built correctly.  On another note, I noticed (not sure how long this has been there) that NAnt can also use the 1.2 Framework (Whidbey), Mono 0.28, and Rotor 1.0 for building.

Share:   Share on LinkedIn    Share on Twitter    Share on Google+    Share on Facebook