.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 implemented by the following frameworks:
- .NET Core
- .NET Framework
- 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
- .NET Core 2.0 SDK (or Visual Studio 2017 Update 3/ Visual Studio 2019)
- ConnectCode Barcode and Fonts package is installed
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.
6. The complete NETStandardBarcode.csproj should look like the following:
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.
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.