.NET Standard Barcode

What is .NET Standard?

.NET Framework is a software framework that is developed by Microsoft to run primarily on Microsoft Windows. Over the years, the framework has been forked and enhanced to serve many different purposes. For example, the Universal Windows Platform uses a specific set of APIs from the .NET Framework to help programmers develop apps for the Windows Store. The .NET Core Framework also uses a subset of APIs from the .NET Framework to support the development of applications that can run on different operating systems such as Windows, Mac, and Linux.

.NET Standard is a specification of common APIs that are available on the different .NET frameworks. By creating a class library (DLL) that targets the .NET Standard, a developer can be assured that his library can be used or shared by projects developed on the various .NET frameworks.

As of .NET Standard v2.0, the .Net Standard specification is impemented by the following frameworks:

  • .NET Core
  • .NET Framework
  • Mono
  • Xamarin.iOS
  • Xamarin.Android
  • Universal Windows Platform

What is .NET Standard Barcode library?

.NET Standard Barcode is a class library (available as a nuget) that generates barcodes using fonts. This class library targets the .NET Standard 2.0 specification and can be used by projects developed on different frameworks. The class library, when used together with ConnectCode Barcode Fonts, generates barcodes of the highest quality and barcodes that are able to meet the strictest requirements of the auto-id industry.

Using the .Net Standard Barcode class library in a .Net Core Console Project


This tutorial uses the .NET Core CLI (Command-Line Interface) toolset (a cross-platform toolchain for developing .NET applications) to create a project that uses the .Net Standard Barcode class library (nuget). although this tutorial uses the CLI toolset, you can also easily re-create the same project in Visual Studio.

1. Launch the "cmd" tool in Windows. If you are using Window 10, you can type "cmd" in "Type here to search".

2. Create a folder by entering "mkdir ConsoleStandard" in the command tool. Enter "cd ConsoleStandard" to go to the folder.

3. Enter "dotnet new console" to create a new .NET project. This CLI command will initialize and create a .NET Core console project for you.

5. After the project is created, enter "notepad ConsoleStandard.csproj" to edit the project file. We need to add a reference to our .NET Standard Barcode nuget.

 <ItemGroup><PackageReference Include="NETStandardBarcode" Version="1.0.1" /></ItemGroup>

6. The complete NETStandardBarcode.csproj should look like the following:

<Project Sdk="Microsoft.NET.Sdk">


  <ItemGroup><PackageReference Include="NETStandardBarcode" Version="1.0.1" /></ItemGroup>


7. Enter "dotnet restore" and this will restore the dependencies, specifically the "NETStandardBarcode.dll" that we specify in our ".csproj" file.

8. We are now ready to add programming codes to make use of the class library. Enter "notepad Program.cs" in the command tool to edit our console program. Modify the "Main" method with the programming codes shown below to create a ITF14 barcode.

using System;

namespace TestConsoleNuget
 class Program
  static void Main(string[] args)
    Net.ConnectCode.Barcode.BarcodeFonts bcf = new Net.ConnectCode.Barcode.BarcodeFonts();
    //This will create a ITF14 barcode.
    bcf.BarcodeType = Net.ConnectCode.Barcode.BarcodeFonts.BarcodeEnum.ITF14;
    bcf.CheckDigit =  Net.ConnectCode.Barcode.BarcodeFonts.YesNoEnum.Yes;
    //Specify the input data
    bcf.Data = "1234567";

7. Save the file. Now, we are ready to run the console application. Enter "dotnet run" and you should see the following output:


This above is the barcode characters with the necessary start/stop and check characters generated by the "NETStandardBarcode" class library.

8. Next, enter "dotnet run > barcodeoutput.txt" to redirect the output into a text file. We are going to apply the ITF14 barcode font to display our barcode.

9. Launch "Wordpad" to open "barcodeoutput.txt". Select the text in the file, change the "Font" to "CCodeITF_S3" (or "CCodeITF_S3_Trial") and then set the "Font Size" to "24". You should see the following ITF14 barcode.

You have successfully generated an ITF14 barcode.