• Introduction
  • Programmer's Guide
  • Technical Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • IC Imaging Control 4 .NET Class Library
      • What's New
        • Version History
        • Transitioning from IC Imaging Control 3.x .NET Component
      • Library Organization
      • Programmer's Guide
        • Getting Started
        • Device Enumeration
        • Configuring the Video Capture Device
        • Grabbing an Image
      • Example Programs
      • Technical Articles
        • Grabber States
        • Accessing Device Properties
        • Error Handling
        • Logging
        • Distributing Your Applications

    Getting Started with IC Imaging Control 4 .NET Class Library

    The IC Imaging Control 4 .NET Class Library is available on nuget.org and as such can be easily added to and updated in a project using standard tools such as Microsoft Visual Studio or the dotnet command line program.

    Using Microsoft Visual Studio

    If you do not have a project yet, create a new .NET project. Both .NET Framework 4 or later and .NET 6 or later are supported.

    Adding the library to a Visual Studio project

    In Solution Explorer, right-click the project and select Manage Nuget Packages....

    Select the Browse tab, and type ic4dotnet into the search box.

    To get test versions of the library, check the Include prerelease box.

    Select the ic4dotnet package and click Install.

    Updating the library in a Visual Studio project

    In Solution Explorer, right-click the project and select Manage Nuget Packages....

    Select the Updates tab.

    Check ic4dotnet and all other packages that need to be upgraded.

    Click the Update button.

    Using the dotnet command line program

    If you do not have a project yet, you can easily create one by running

    $ mkdir HelloIC4
    $ cd HelloIC4
    $ dotnet new console
    

    This creates a new directory HelloIC4, and in that directory instructs the dotnet utility to create a new console project.

    Adding the library to a dotnet project

    To add the IC Imaging Control 4 .NET Class Library to that project, run

    $ dotnet add package ic4dotnet
    

    To get test versions of the library, append --prerelease.

    To install a specific version, add --version <version> to the command.

    Executing the add package command will add a package reference to the ic4dotnet assembly, download all dependencies and integrate them into your project. Upon building, all required DLLs will be copied into the output directory.

    To check whether the reference was added successfull, add a call to Library.Init to Program.cs:

    ic4.Library.Init();
    Console.WriteLine("Hello, IC4!");
    

    Then, call dotnet run to execute the program:

    $ dotnet run
    Hello, IC4!
    

    Updating to a new library version in a dotnet project

    To upgrade the package reference added in the previous step, simple run the command again:

    $ dotnet add package ic4dotnet
    

    After successful execution, the package reference is updated to the newest available version. To see the referenced packages, use

    $ dotnet list package
    
    In this article
    Copyright ©️ 2024 The Imaging Source Europe GmbH www.theimagingsource.com