BarcodeParserBuilder 0.1.8

dotnet add package BarcodeParserBuilder --version 0.1.8
                    
NuGet\Install-Package BarcodeParserBuilder -Version 0.1.8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BarcodeParserBuilder" Version="0.1.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BarcodeParserBuilder" Version="0.1.8" />
                    
Directory.Packages.props
<PackageReference Include="BarcodeParserBuilder" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BarcodeParserBuilder --version 0.1.8
                    
#r "nuget: BarcodeParserBuilder, 0.1.8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BarcodeParserBuilder@0.1.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BarcodeParserBuilder&version=0.1.8
                    
Install as a Cake Addin
#tool nuget:?package=BarcodeParserBuilder&version=0.1.8
                    
Install as a Cake Tool

BarcodeParserBuilder

.NET library to parse and build barcode strings.

The library allows .NET applications to throw any barcode string to it and receive an class object back that contains all the barcode data like
type, product code , product code type/schema, expiration date etc etc...

The library also verifies all data when parsing & setting properties so that it follows the specifications of the barcode type.
A barcode can be parsed and build in less than 4 lines of code.

Currently supports GS1, GS1-128, EAN/UPC, PPN, MSI & HIBC.

When combined with barcode imaging projects like Zxing you can scan, parse, build & create any barcode to your needs.

Parsing Example

The following code

bool isSuccessful = new BarcodeParserBuilder().TryParse($"0134567890123457103456789{(char)0x1D}213456789-012", out Barcode barcode);  
Console.WriteLine($"The barcode was {(isSuccessful ? "parsed" : "unparsed")}!");  
Console.WriteLine($"Barcode Type : {barcode.BarcodeType}");  
Console.WriteLine($"Object Type : {barcode.GetType().Name}");  
Console.WriteLine($"Product Code Schema : {barcode.ProductCode.Schema}");  
Console.WriteLine($"Product Code : {barcode.ProductCode.Value}");  
Console.WriteLine($"Batch : {barcode.BatchNumber}");  
Console.WriteLine($"Serial : {barcode.SerialNumber}");

will result in the following output :

The barcode was parsed!
Barcode Type : GS1
Object Type : GS1Barcode
Product Code Schema : GTIN
Product Code : 34567890123457
Batch : 3456789
Serial : 3456789-012

The returned 'barcode' object can be cast into a 'GS1Barcode' object, which allows for GS1 specific content to be accessed since the example is a GS1 barcode.
This is because all barcode classes are derrived from the barcode class.

Building Example

The following code

GS1Barcode barcode = New GS1Barcode();  
barcode.ProductCode = ProductCode.ParseGtin("34567890123457");  
barcode.BatchNumber = "3456789";  
barcode.SerialNumber = "3456789-012";  
string barcodeString = new BarcodeParserBuilder().Build(barcode);  
Console.WriteLine($"barcode String : {barcodeString}");  

Will result in the following output :

barcode String : 0134567890123457103456789<gs>213456789-012

Note that the '<gs>' in the string is the GS1 group separator and is in reality the actual character(0x1D), which is a none-readable character.
This is why i placed '<gs>' in the example.

TODO :

Our Current Todo exists of adding support for the following barcodes :

  • ISBT 128

Licensing & Rules

The project is released under the LGPL license. In short that means that any project can use this library or its released packages for any usage (including commercial usage).
However, Any alterations done need to be open source or publically mentioned what has been changed.
I also kindly ask that any alterations are merged back into the main repository so that anyone can benefit from the changes/added functionality.
This is because we are still lacking a lot of functionality (like HIBC parsed into PPN as to the HIBC 2.4 standard) and everyone could benefit from that.
If you would like me to look into adding a barcode type , don't hesitate to create an issue or pull request!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.8 663 7/16/2025
0.1.7 330 5/30/2025
0.1.6 145 5/29/2025
0.1.5 399 4/14/2025
0.1.4 36,567 7/2/2024
0.1.4-preview2 148 4/5/2024
0.1.4-preview1 125 3/17/2024
0.1.3 15,484 12/25/2023
0.1.3-preview3 141 12/20/2023
0.1.3-preview2 145 12/16/2023
0.1.3-preview1 201 10/30/2023
0.1.2 22,802 5/21/2023
0.1.1 274 5/1/2023
0.1.1-preview1 205 4/9/2023
0.1.0 4,562 9/28/2022
0.0.6 620 9/15/2022
0.0.6-alpha.0.3 160 9/6/2022
0.0.6-alpha.0.1 152 9/3/2022
0.0.5 1,876 5/28/2022
0.0.4 538 4/18/2022
0.0.3 9,576 11/8/2021
0.0.2 473 9/11/2021
0.0.1 550 9/5/2021
0.0.0-alpha.0 78 3/17/2024