TOP

Getting Started

Applies to: ASN.1/C# 4.5

Installation

Prerequisites

The prerequisites for installing and running the OSS ASN.1 Tools for C# are as follows:

  • Microsoft .NET Framework 3.0 or later
  • Microsoft C# 3.0 with Microsoft Visual Studio 2008 or later (Visual Studio is recommended, but not required)
  • ossinfo license file (no extension)

Every distributed copy of the OSS ASN.1 Tools for C# is associated with a unique license number. The license determines, among other things, which functions of the OSS ASN.1 Tools are available to you.

Installing

Run the installer executable and follow the on-screen instructions. The installation software will search for the ossinfo license file or you can provide its location when prompted.

For your convenience, we provide a command-prompt window with all the environment variables preset for development. In the Windows Start menu, select the OSS ASN.1 Tools for C# program group and click OSS Command Prompt.

Once installed, the compiler/runtime will look for the ossinfo license file in the %ProgramFiles%\OSS Nokalva directory or in the directory specified by the OSSINFO environment variable.

Upgrading from previous versions of the OSS ASN.1 Tools

For users of 4.x versions of the OSS ASN.1 Tools

The new version is backward compatible with previous 4.x releases.

For users of 3.x versions of the OSS ASN.1 Tools

This version is not compatible with 3.x versions. To take advantage of the new, faster codec, your existing applications must be modified to use the new API. However, you can install 4.x versions alongside an older version of the OSS ASN.1 Tools for C# and the two versions will peacefully co-exist. See the Migration Guide for more information.

Getting Started

You can start with the tutorials, which include Visual Studio projects with pre-compiled schemas that offer a one-click build. Or, follow the steps below to build any application, including the samples.

  1. Compile your ASN.1 specifications. Use either the ASN.1/C# command-line compiler or ASN.1 Studio. This will produce C# source files that contain the encoding and decoding classes, and the type representations to be used by your application.
  2. Launch your C# development environment.
  3. Reference the runtime codec assembly %ProgramFiles%\OSS Nokalva\asn1csharp\<platform name>\<version>\bin\asn1csrt.dll, which contains the runtime code needed for encoding/decoding.
  4. Write some code using the generated classes and build your application. For example, for the BCAS schema, which is included in the samples:

  5. using Oss.Asn1; 
    using BCAS.BCASModule; 
    using BCAS; 
    
    namespace BCASApp 
        public class Program 
        { 
            public static void Main() 
            { 
                BerCodec codec = new BerCodec(); 
                MemoryStream stream = new MemoryStream(); 
                BBCard pdu = new BBCard(); 
      
                try 
                { 
                    // init PDU 
                    pdu.Name = "Casey"; 
                    pdu.Team = "Mudville Nine"; 
                    pdu.Age = 32; 
                    pdu.Position = "left field"; 
                    pdu.Handedness = BBCard.HandednessType.Ambidextrous; 
                    pdu.BattingAverage = 0.25; 
      
                    // encode PDU 
                    codec.Encode(pdu, stream); 
      
                    // move stream position to beginning for decoding 
                    stream.Position = 0; 
      
                    // decode PDU 
                    codec.Decode(stream, pdu); 
      
                    // print PDU 
                    Console.WriteLine(pdu); 
                } 
                catch (Exception ex) 
                { 
                    Console.WriteLine("Codec exception:" + ex); 
                } 
            } 
        } 
    }
    

  6. C#-compile the generated code to build your application.
  7. Run and test your application.

The sample files included with the software are installed in %ProgramData%\OSS Nokalva\asn1csharp\<platform name>\<version>\samples.

The tutorial files included with the software are installed in %ProgramData%\OSS Nokalva\asn1csharp\<platform name>\<version>\tutorials.


This documentation applies to the OSS® ASN.1 Tools for C# release 4.5 and later.

Copyright © 2017 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C# is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C# are available to you.