Sample code for zebra scanner SDK gives syntax errors

I’m trying to learn the zebra scanner SDK and have everything set up for it in visual studio, but the sample code given within the documentation gives the error

“Error CS1752 Interop type ‘CCoreScannerClass’ cannot be embedded. Use the applicable interface instead.”

the code I’m trying to use is

using System;
using System.Collections.Generic;
using System.Text;
using CoreScanner;
namespace ConsoleApplication1
    class Program
        // Declare CoreScannerClass
        static CCoreScannerClass cCoreScannerClass;
        static void Main(string[] args)
            //Instantiate CoreScanner Class
            cCoreScannerClass = new CCoreScannerClass();
            //Call Open API
            short[] scannerTypes = new short[1]; // Scanner Types you are interested in
            scannerTypes[0] = 1; // 1 for all scanner types
            short numberOfScannerTypes = 1; // Size of the scannerTypes array
            int status; // Extended API return code
            cCoreScannerClass.Open(0, scannerTypes, numberOfScannerTypes, out status);
            if (status == 0)
                Console.WriteLine("CoreScanner API: Open Successful");
                Console.WriteLine("CoreScanner API: Open Failed");

I’ve mainly just tried different ways of defining the class and referencing CCoreScannerClass seems to lead to an error not matter what.

  • Try instantiate Core Scanner class this way cCoreScanner = new CCoreScanner();


Leave a Comment