Navigation

Search

Categories

On this page

Using NAnt custom tasks of .NET Smartcard SDK

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Sign In

 Friday, December 17, 2004
Friday, December 17, 2004 5:54:08 PM (Central Standard Time, UTC-06:00) ( )

Ant & NAnt have been the pioneers in recent times for automating the build and as Ant/NAnt guys describe their fascinating software - its kind of Make but without Make wrinkles. I have been a great fan of this stuff for a long time now. NET Smartcard SDK offers the custom NAnt tasks to automate the interactions with .NET Smartcard. I am going to describe here the custom tasks we have for .NET Smartcard.

If you are not familiar with NAnt please visit http://nant.sourceforge.net/

Below are described the custom NAnt tasks available for .NET Smartcard framework SDK.

  • LoaderTask             
         <target name="build" description="load and execute assembly">
         
              <load file="bin\debug\Test1.exe" todir="C:\Pub" execute="true"
                                                          reload="true" serviceName="test"/>        
 
 
               <load todir="D:\Pub">
                       <fileset basedir=".">
                            <includes name="Rijndael.bin"/>
                            <includes name="server\AppConfig.xml"/>
                       </fileset>
              </load>

         </target>
 
 
         This is most used task and also part of Server template in VS.NET 2003. Let's look at the attributes
 
 Name Description Required
file

File to be loaded in the card. You can specify the full or relative path.

    YES
todir On card directory in which to download the Test1.exe     YES
execute Run the executable [ This creates a .NET Smartcard service]     NO
reload If 'file' is already loaded in the assembly this will first remove the service installed & delete the file before downloading it again     NO
serviceName This is needed if you specify reload attribute since name of the service is needed to uninstall it.     NO
 
  • Delete2Task
        <delete2 file="D:\Pub\Rijndael.bin"/>
        <delete2 file="C:\Pub\server.exe" unregister="MyServiceUri.apdu"/>
       
        Delete task has 2 as a suffix to distinguish it from regular delete task.

       

Name Description Required
file

Full path to the on-card file to be deleted.

  YES
unregister If file to be deleted is an executable then name of the attribute is to be specified as value of this attribute   YES

  • ExecuteAssemblyTask       

        <execute file="C:\MyDir\MyProfile.exe"/>

        <execute>
            <fileset basedir="C:\MyDir2">
                <includes name="server1.exe"/>
                <includes name="server2.exe"/>
            </fileset>
        </execute>
 
There are still more tasks to write for administrating the card.
 
Running the build file from CardExplorer
 
 

Changing the path to NAnt binaries

.NET Smartcard SDK installs the NAnt binaries (shown below). The folder also contains netCard.NAntTasks.dll assembly which contain the above mentioned task. If you already have NAnt installed on your PC or want to download an updated version, you should add a path variable NANT_HOME in System settings & copy the netCard.NAntTasks.dll into the bin folder of NANT_HOME. If NANT_HOME is not defined, SDK takes [INSTALL_DIR]\3rdParty\NAnt as the default path for NAnt.