Generate barcodes in various .NET Core development environments
Barcode Generator for .NET Core dlls are built based on .NET Standard 2.0. And they are supporting the following .NET implementation
You can easiy create 2d and linear barcode images in your .NET Core and .NET Framework projects.
- .NET and .NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0
- .NET Framework 4.6.2 (and above) for Windows and Azure
- Mono 5.4, 6.4
- Universal Windows Platform
- Xamarin.iOS
- Xamarin.Mac
- Xamarin.Android
You can easiy create 2d and linear barcode images in your .NET Core and .NET Framework projects.
- Generate barcodes in Console App (.NET Core)
- Generate barcodes in Class Library (.NET Core)
- Generate barcodes in MSTest Test Project (.NET Core)
- Generate barcodes in NUnit Test Project (.NET Core)
- Generate barcodes in xUnit Test Project (.NET Core)
- Generate barcodes in ASP.NET Core Web Application
Compare .NET Core Barcode Generator versions (System.Drawing.Common vs SkiaSharp)
Why need two Barcode Generator dlls
In .NET Core Barcode Generator dlls folder, there are two dlls, OnBarcode.Barcode.Common.dll and OnBarcode.Barcode.Common.Skia.dll.
Both of them are built using .NET Standard 2.0 and support all most the same barcode generation features in .NET 7, 6, 5.
- OnBarcode.Barcode.Common.dll: It is based on System.Drawing.Common, which is recommended in Windows environment. System.Drawing.Common is not fully supported on non-Windows environment. See details at https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only
- OnBarcode.Barcode.Common.Skia.dll: It is based on SkiaSharp (https://github.com/mono/SkiaSharp), which is suggested in non Windows, such as MacOS, Linux operation systems.
The differences between two dlls
Both of the two dlls support generating ISO standard barcodes with rich API on .NET Core.
| Barcode Generation | OnBarcode.Barcode.Common.dll | OnBarcode.Barcode.Common.Skia.dll |
| Dependencies | System.Drawing.Common: version 4.5.0 or later. Recommend: 7.0.0 (Nov 08, 2022) | SkiaSharp: version 2.80.0 or later. Recommend: 2.88.6 (Sep 21, 2023) |
| Supported raster image file formats | BMP, GIF, JPEG, PNG, TIFF | JPEG, PNG, WEBP |
| Barcode image resolution setting to image file (file stream or file data bytes) | Yes | No |
Install Barcode Generator for .NET Core DLL
Install OnBarcode.Barcode.Common.dll
Please follow the steps below:
- Open the .net core project in Visual Studio
- Search and install System.Drawing.Common (Version 6.0.0 or later) Nuget package
- Add dll OnBarcode.Barcode.Common.dll from downloaded package /dll/NetStandard2.0/ to .net project reference
Install OnBarcode.Barcode.Common.Skia.dll
Please follow the steps below:
- Open the .net core project in Visual Studio
- Search and install SkiaSharp Nuget package
- Add dll OnBarcode.Barcode.Common.Skia.dll from downloaded package /dll/NetStandard2.0/ to .net project reference
Install & Setup on ASP.NET Core
We have prepared step by step tutorials on how to install .NET Core barcode generator dll on ASP.NET Core web application.
C# .NET Core Barcode Generator Quick Start
1. How to install .NET Barcode Generator Control to your Visual C# .NET Core project?
Add OnBarcode.Barcode.Common.dll to your C# or VB.NET project reference.
2. How to create linear barcodes in C# .NET Core class?
// Create linear barcode object
Linear barcode = new Linear();
// Set barcode symbology type to Code-39
barcode.Type = BarcodeType.CODE39;
// Set barcode data to encode
barcode.Data = "0123456789";
// Set barcode bar width (X dimension) in pixel
barcode.X = 1;
// Set barcode bar height (Y dimension) in pixel
barcode.Y = 60;
// Draw & print generated barcode to png image file
barcode.drawBarcode("C://csharp-code39.png");

3. How to draw & print QR-Code in C# .NET Core class?
// Create QRCode object
QRCode qrCode = new QRCode();
// Set QR Code data to encode
qrCode.Data = "VB.NET QRCode";
// Set QRCode data mode (QR-Code Barcode Settings)
qrCode.DataMode = QRCodeDataMode.Auto;
// Draw & print generated QR Code to jpeg image file
qrCode.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
qrCode.drawBarcode("C://csharp-qrcode.jpg");4. How to create & print Data Matrix in C# .NET Core class?
DataMatrix datamatrix = new DataMatrix();
// Create Data Matrix object
datamatrix.Data = "VB.NET DataMatrix";
// Set Data Matrix data to encode
datamatrix.DataMode = DataMatrixDataMode.ASCII;
// Set the data mode (Data Matrix Barcode Settings)
// Draw and print created Data Matrix to gif image file
datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;
datamatrix.drawBarcode("C://csharp-data-matrix.gif");5. How to create & print PDF-417 in C# .NET Core class?
// Create PDF417 object
PDF417 pdf417 = new PDF417();
// Set Data Matrix data to encode
pdf417.Data = "PDF-417";
// Set PDF-417 data mode (PDF-417 Barcode Settings)
pdf417.DataMode = PDF417DataMode.Auto;
// Set PDF-417 number of rows
pdf417.RowCount = 3;
// Set PDF-417 number of columns
pdf417.ColumnCount = 5;
// Draw and print generated PDF417 to gif image file
pdf417.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;
pdf417.drawBarcode("C://csharp-pdf417.gif");6. In C# .NET Core Barcode Generator, how to print & encode barcodes to GIF, JPEG, PNG & BMP?
// Create linear barcode object
Linear barcode = new Linear();
// Set barcode symbology type to Code-39
barcode.Type = OnBarcode.Barcode.BarcodeType.CODE39;
// Set barcode data to encode
barcode.Data = "0123456789";
// Encode barcodes to other image format, by change file extension
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif;
barcode.drawBarcode("C://csharp-barcode-code39.gif");
C#.NET Barcode Generation Guides & Tutorials for Each Barcode
Top
Barcode Control for C#.NET - Bar Code Type Generation
- C#.NET Core 1D / Linear Barcodes:
- C#.NET Core 2D / Matrix Barcodes: Data Matrix, PDF-417, QR Code, Micro PDF-417, Micro QR Code
