Tuesday, February 6

Nant and licensed 3rd party controls

I've been having some problems building a project containing licensed grid and graph components from ComponentOne using NAnt. The project built correctly in Visual Studio, but when built with NAnt I got a box saying the component was not licensed.

I've found some others have had similar problems, but no solutions have been posted. I go it working after a lot of trial and error as follows:

1) Use an <exec> task to run the license compiler (lc.exe).
2) Ensure the /target: command does not contain a path.
3) Ensure your <csc> task does not contain a path in its output section.
4) Ensure the licenses file is included in the resources section. This did not work when it was included as an argument with an <arg value="/resource" element.
5) Copy the file to the correct destination directory at the end.

Here's the relevant part of my build file.


<target name="project" description="build project"
depends="..." >


<exec program="C:\Program Files\Microsoft
Visual Studio 8\SDK\v2.0\bin\LC.exe"
commandline="/target:project.exe
/complist:c:/nantcheckout/project/Properties\
licenses.licx
/outdir:c:/nantbuild /i:c:\nantbuild\C1.Data.2.dll
/i:c:\nantbuild\C1.Win.C1Chart.2.dll
/i:c:\nantbuild\C1.Win.C1Chart3D.2.dll
/i:c:\nantbuild\CAInterfaces.dll
/i:c:\nantbuild\CDERules.dll
/i:c:\nantbuild\clTreeViewHashT.dll
/i:C:\WINDOWS\Microsoft.NET\Framework\
v2.0.50727\System.configuration.dll
/i:C:\WINDOWS\Microsoft.NET\Framework\
v2.0.50727\System.Data.dll
/i:C:\WINDOWS\Microsoft.NET\Framework\
v2.0.50727\System.Deployment.dll

...

/>

<csc target="winexe"
output="PCOBrowserGE.exe" debug="false"
define="TRACE" >
<sources>
<include name="c:/nantcheckout/
project/*.cs" />
<include name="c:/nantcheckout/
project/Properties/*.cs" />
</sources>
<resources>
<include name="c:/nantcheckout/
project/Properties/*.resx" />
<include name="c:/nantcheckout/
project/*.resx" />
<include name="c:/nantbuild/
project.exe.licenses" />
</resources>
<arg value="/reference:C:\nantbuild\
c1.win.c1chart.2.dll" />
<arg value="/reference:C:\nantbuild\
c1.win.c1chart3d.2.dll" />
<arg value="/reference:C:\nantbuild\
c1.data.2.dll" />
</csc>

<copy file="pcobrowserge.exe" tofile="
c:/nantbuild/project.exe" />
</target>

10 Characteristics of a great programmer

Steve Riley has complied a great list of the 10 characteristics of a great programmer.

I'd agree with everything on the list - the one thing that is missing is that great programmers know why they are doing what they are doing - there's no point producing an excellent solution to the wrong problem.