Migrating from NetBarcode to IronBarcode
This guide covers the complete migration path from NetBarcode to IronBarcode, with package removal steps, namespace updates, API translation examples, and a checklist for locating every call site before the migration begins. The guide addresses the common scenario in which a project starts with NetBarcode for 1D barcode generation and later requires 2D formats, reading capability, or clarification of the SixLabors.ImageSharp license obligation — all of which are outside NetBarcode's scope.
Why Migrate from NetBarcode
Format Ceiling: NetBarcode's Type enum defines exactly 11 barcode formats, all linear. There is no entry for QR Code, DataMatrix, PDF417, or Aztec. When a project adds a QR code requirement — for contactless delivery links, mobile deep links, or a pharmaceutical DataMatrix mandate — NetBarcode cannot satisfy it. The only path within the library's design is to stop using it for that format and introduce a separate package. Each additional format requirement that falls outside the 11-entry enum adds another library to the dependency tree.
No Reading API: NetBarcode generates barcode images and provides no method to decode them. A project that needs to scan return shipment labels, extract barcode values from supplier invoices, or validate that a printed barcode matches its source data must add a separate reading library. ZXing.Net is the most common choice, introducing a third API surface in a codebase that already holds NetBarcode and, typically, a QR-specific library.
ImageSharp Commercial License: NetBarcode depends on SixLabors.ImageSharp, which uses a split commercial license. The free tier applies to open-source projects and companies below a defined annual revenue threshold; above that threshold a commercial license is required. This condition is embedded in the transitive dependency chain and is not surfaced by NuGet during installation. A retail or logistics company processing barcodes at scale — precisely the use case NetBarcode targets — may be operating above the threshold without having evaluated the obligation.
Multi-Library Accumulation: Projects that reach for QRCoder when QR codes are needed, and then ZXing.Net when reading becomes necessary, accumulate three separate barcode-related dependencies. Each has its own release schedule, its own ImageSharp version expectation, and its own API to maintain. Consolidating to a single library that covers generation, reading, 1D, and 2D eliminates the cross-library version management problem.
The Fundamental Problem
A project that starts with NetBarcode alone and then grows to require 2D formats ends up with this kind of split import:
// NetBarcode for 1D — one library, one API
using NetBarcode;
var code128 = new Barcode("12345", Type.Code128);
code128.SaveImageFile("label.png");
// QRCoder added separately for QR — second library, second API
using QRCoder;
var qrGenerator = new QRCodeGenerator();
var qrData = qrGenerator.CreateQrCode("https://example.com", QRCodeGenerator.ECCLevel.M);
var png = new PngByteQRCode(qrData).GetGraphic(20);
File.WriteAllBytes("qr.png", png);
// NetBarcode for 1D — one library, one API
using NetBarcode;
var code128 = new Barcode("12345", Type.Code128);
code128.SaveImageFile("label.png");
// QRCoder added separately for QR — second library, second API
using QRCoder;
var qrGenerator = new QRCodeGenerator();
var qrData = qrGenerator.CreateQrCode("https://example.com", QRCodeGenerator.ECCLevel.M);
var png = new PngByteQRCode(qrData).GetGraphic(20);
File.WriteAllBytes("qr.png", png);
Imports NetBarcode
Imports QRCoder
Imports System.IO
' NetBarcode for 1D — one library, one API
Dim code128 As New Barcode("12345", Type.Code128)
code128.SaveImageFile("label.png")
' QRCoder added separately for QR — second library, second API
Dim qrGenerator As New QRCodeGenerator()
Dim qrData = qrGenerator.CreateQrCode("https://example.com", QRCodeGenerator.ECCLevel.M)
Dim png = New PngByteQRCode(qrData).GetGraphic(20)
File.WriteAllBytes("qr.png", png)
After migrating to IronBarcode, the same two outputs come from a single import:
using IronBarCode;
BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128)
.SaveAsPng("label.png");
BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode)
.SaveAsPng("qr.png");
using IronBarCode;
BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128)
.SaveAsPng("label.png");
BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode)
.SaveAsPng("qr.png");
Imports IronBarCode
BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128) _
.SaveAsPng("label.png")
BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode) _
.SaveAsPng("qr.png")
IronBarcode vs NetBarcode: Feature Comparison
| Feature | NetBarcode | IronBarcode |
|---|---|---|
| 1D barcode generation | Yes | Yes |
| 2D barcode generation (QR, DataMatrix, PDF417, Aztec) | No | Yes |
| Barcode reading from images | No | Yes |
| Barcode reading from PDF documents | No | Yes |
| 1D format count | 14 | 30+ |
| 2D format count | 0 | 8+ |
| Total symbologies | 14 | 50+ |
| GS1-128, GS1 DataBar | No | Yes |
| Postal formats | No | Yes |
| SVG output | No | Yes |
| Batch processing | Manual | Built-in |
| ImageSharp dependency | Yes (split license) | No |
| Commercial support | Community | Professional |
| License model | MIT (+ ImageSharp conditions) | Commercial |
Quick Start: NetBarcode to IronBarcode Migration
Step 1: Replace NuGet Package
Remove NetBarcode and its transitive ImageSharp dependency:
dotnet remove package NetBarcode
dotnet remove package SixLabors.ImageSharp
dotnet remove package NetBarcode
dotnet remove package SixLabors.ImageSharp
Note that SixLabors.ImageSharp may reappear in the restored package list if other packages in the project also reference it transitively. After removal, run dotnet list package --include-transitive to confirm whether ImageSharp remains and whether its commercial license condition still applies to the project.
Step 2: Add IronBarcode
dotnet add package IronBarcode
dotnet add package IronBarcode
The NuGet package name is IronBarcode; the namespace used in code is IronBarCode (note the capital C).
Step 3: Update Namespaces and Initialize License
Replace the old using directives in every file that contained NetBarcode calls:
// Remove these:
// using NetBarcode;
// using SixLabors.ImageSharp;
// using SixLabors.ImageSharp.PixelFormats;
// using SixLabors.Fonts;
// Add this:
using IronBarCode;
// Remove these:
// using NetBarcode;
// using SixLabors.ImageSharp;
// using SixLabors.ImageSharp.PixelFormats;
// using SixLabors.Fonts;
// Add this:
using IronBarCode;
Imports IronBarCode
Add license initialization once at application startup — in Program.cs, Startup.cs, or the project's entry point:
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
A free trial key is available for evaluation; purchasing a license removes the trial watermark from generated barcode images.
Code Migration Examples
Code128 Generation
The most common NetBarcode usage pattern translates directly to IronBarcode with a constructor-to-static-method change and a method rename.
NetBarcode Approach:
using NetBarcode;
var barcode = new Barcode("12345678901234", Type.Code128);
barcode.SaveImageFile("shipping-label.png");
using NetBarcode;
var barcode = new Barcode("12345678901234", Type.Code128);
barcode.SaveImageFile("shipping-label.png");
Imports NetBarcode
Dim barcode As New Barcode("12345678901234", Type.Code128)
barcode.SaveImageFile("shipping-label.png")
IronBarcode Approach:
using IronBarCode;
BarcodeWriter.CreateBarcode("12345678901234", BarcodeEncoding.Code128)
.SaveAsPng("shipping-label.png");
using IronBarCode;
BarcodeWriter.CreateBarcode("12345678901234", BarcodeEncoding.Code128)
.SaveAsPng("shipping-label.png");
Imports IronBarCode
BarcodeWriter.CreateBarcode("12345678901234", BarcodeEncoding.Code128) _
.SaveAsPng("shipping-label.png")
The new Barcode(data, Type.X) constructor becomes BarcodeWriter.CreateBarcode(data, BarcodeEncoding.X). The SaveImageFile() method becomes SaveAsPng(), SaveAsJpeg(), or SaveAsWindowsBitmap() depending on the output format required. All available 1D barcode generation options are documented in the IronBarcode how-to guides.
EAN-13
Retail product barcode types map directly between libraries with a constant rename and a method rename.
NetBarcode Approach:
using NetBarcode;
var ean13 = new Barcode("5901234123457", Type.EAN13);
ean13.SaveImageFile("product-ean.png");
using NetBarcode;
var ean13 = new Barcode("5901234123457", Type.EAN13);
ean13.SaveImageFile("product-ean.png");
Imports NetBarcode
Dim ean13 As New Barcode("5901234123457", Type.EAN13)
ean13.SaveImageFile("product-ean.png")
IronBarcode Approach:
using IronBarCode;
BarcodeWriter.CreateBarcode("5901234123457", BarcodeEncoding.EAN13)
.SaveAsPng("product-ean.png");
using IronBarCode;
BarcodeWriter.CreateBarcode("5901234123457", BarcodeEncoding.EAN13)
.SaveAsPng("product-ean.png");
Imports IronBarCode
BarcodeWriter.CreateBarcode("5901234123457", BarcodeEncoding.EAN13) _
.SaveAsPng("product-ean.png")
The encoding constant names match the NetBarcode Type enum member names where direct equivalents exist. Note that UPC-A (Type.UPCA), UPC-E (Type.UPCE), ITF (Type.ITF), and MSI (Type.MSI) are not part of the NetBarcode Type enum — if those formats are required, IronBarcode supports them natively via BarcodeEncoding.UPCA, BarcodeEncoding.UPCE, BarcodeEncoding.ITF, and BarcodeEncoding.MSI.
GetImage() to ToPngBinaryData()
NetBarcode's GetImage() method returns SixLabors.ImageSharp.Image<Rgba32>, which requires explicit ImageSharp imports in calling code and ties downstream logic to the ImageSharp API. IronBarcode exposes binary and stream output methods directly on the GeneratedBarcode object, eliminating the ImageSharp dependency from calling code entirely.
NetBarcode Approach:
using NetBarcode;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
var barcode = new Barcode("12345", Type.Code128);
Image<Rgba32> image = barcode.GetImage();
using var stream = new MemoryStream();
image.SaveAsPng(stream);
byte[] bytes = stream.ToArray();
using NetBarcode;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
var barcode = new Barcode("12345", Type.Code128);
Image<Rgba32> image = barcode.GetImage();
using var stream = new MemoryStream();
image.SaveAsPng(stream);
byte[] bytes = stream.ToArray();
Imports NetBarcode
Imports SixLabors.ImageSharp
Imports SixLabors.ImageSharp.PixelFormats
Imports System.IO
Dim barcode As New Barcode("12345", Type.Code128)
Dim image As Image(Of Rgba32) = barcode.GetImage()
Using stream As New MemoryStream()
image.SaveAsPng(stream)
Dim bytes As Byte() = stream.ToArray()
End Using
IronBarcode Approach:
using IronBarCode;
var barcode = BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128);
// Retrieve bytes directly — no ImageSharp type in calling code
byte[] bytes = barcode.ToPngBinaryData();
// Or write to a stream directly
using var stream = new MemoryStream();
barcode.SaveAsPng(stream);
using IronBarCode;
var barcode = BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128);
// Retrieve bytes directly — no ImageSharp type in calling code
byte[] bytes = barcode.ToPngBinaryData();
// Or write to a stream directly
using var stream = new MemoryStream();
barcode.SaveAsPng(stream);
Imports IronBarCode
Dim barcode = BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128)
' Retrieve bytes directly — no ImageSharp type in calling code
Dim bytes As Byte() = barcode.ToPngBinaryData()
' Or write to a stream directly
Using stream As New MemoryStream()
barcode.SaveAsPng(stream)
End Using
Code that performed further ImageSharp manipulations on the Image<Rgba32> result — resizing, compositing, format conversion — will need those operations evaluated individually, as IronBarcode does not expose an ImageSharp object.
Replacing NetBarcode and QRCoder Together
Projects running NetBarcode alongside QRCoder can replace both at once. IronBarcode's 2D generation uses the same BarcodeWriter.CreateBarcode method as its 1D generation; only the BarcodeEncoding constant differs. Refer to the 2D barcode generation guide for encoding options and configuration.
NetBarcode and QRCoder Approach:
using NetBarcode;
using QRCoder;
// 1D with NetBarcode
var code128 = new Barcode("12345", Type.Code128);
code128.SaveImageFile("label.png");
// QR with QRCoder
var qrGenerator = new QRCodeGenerator();
var qrData = qrGenerator.CreateQrCode("https://example.com", QRCodeGenerator.ECCLevel.M);
var qrCode = new PngByteQRCode(qrData);
File.WriteAllBytes("qr.png", qrCode.GetGraphic(20));
using NetBarcode;
using QRCoder;
// 1D with NetBarcode
var code128 = new Barcode("12345", Type.Code128);
code128.SaveImageFile("label.png");
// QR with QRCoder
var qrGenerator = new QRCodeGenerator();
var qrData = qrGenerator.CreateQrCode("https://example.com", QRCodeGenerator.ECCLevel.M);
var qrCode = new PngByteQRCode(qrData);
File.WriteAllBytes("qr.png", qrCode.GetGraphic(20));
Imports NetBarcode
Imports QRCoder
' 1D with NetBarcode
Dim code128 As New Barcode("12345", Type.Code128)
code128.SaveImageFile("label.png")
' QR with QRCoder
Dim qrGenerator As New QRCodeGenerator()
Dim qrData = qrGenerator.CreateQrCode("https://example.com", QRCodeGenerator.ECCLevel.M)
Dim qrCode As New PngByteQRCode(qrData)
File.WriteAllBytes("qr.png", qrCode.GetGraphic(20))
IronBarcode Approach:
using IronBarCode;
// 1D — same API as 2D
BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128)
.SaveAsPng("label.png");
// QR — change the encoding constant, nothing else
BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode)
.SaveAsPng("qr.png");
// Additional 2D formats available with no further imports
BarcodeWriter.CreateBarcode("01034531200000111719112510ABCD1234", BarcodeEncoding.DataMatrix)
.SaveAsPng("pharma-label.png");
using IronBarCode;
// 1D — same API as 2D
BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128)
.SaveAsPng("label.png");
// QR — change the encoding constant, nothing else
BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode)
.SaveAsPng("qr.png");
// Additional 2D formats available with no further imports
BarcodeWriter.CreateBarcode("01034531200000111719112510ABCD1234", BarcodeEncoding.DataMatrix)
.SaveAsPng("pharma-label.png");
Imports IronBarCode
' 1D — same API as 2D
BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.Code128) _
.SaveAsPng("label.png")
' QR — change the encoding constant, nothing else
BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode) _
.SaveAsPng("qr.png")
' Additional 2D formats available with no further imports
BarcodeWriter.CreateBarcode("01034531200000111719112510ABCD1234", BarcodeEncoding.DataMatrix) _
.SaveAsPng("pharma-label.png")
Adding Reading Capability
If the project also used ZXing.Net for reading, that dependency can be removed alongside NetBarcode. IronBarcode's BarcodeReader handles images and PDF documents with automatic format detection.
ZXing.Net Approach:
using ZXing;
using ZXing.Common;
using ZXing.Rendering;
var reader = new BarcodeReaderGeneric();
reader.Options = new DecodingOptions { TryHarder = true };
// Bitmap loading and format-specific handling required before decode call
using ZXing;
using ZXing.Common;
using ZXing.Rendering;
var reader = new BarcodeReaderGeneric();
reader.Options = new DecodingOptions { TryHarder = true };
// Bitmap loading and format-specific handling required before decode call
Imports ZXing
Imports ZXing.Common
Imports ZXing.Rendering
Dim reader = New BarcodeReaderGeneric()
reader.Options = New DecodingOptions With {.TryHarder = True}
' Bitmap loading and format-specific handling required before decode call
IronBarcode Approach:
using IronBarCode;
// Read from an image file — automatic format detection
var imageResults = BarcodeReader.Read("shipping-label.png");
foreach (var r in imageResults)
{
Console.WriteLine($"{r.BarcodeType}: {r.Value}");
}
// Read from a PDF document — no separate PDF library needed
var pdfResults = BarcodeReader.Read("supplier-invoice.pdf");
foreach (var r in pdfResults)
{
Console.WriteLine($"Page {r.PageNumber}: {r.BarcodeType}: {r.Value}");
}
using IronBarCode;
// Read from an image file — automatic format detection
var imageResults = BarcodeReader.Read("shipping-label.png");
foreach (var r in imageResults)
{
Console.WriteLine($"{r.BarcodeType}: {r.Value}");
}
// Read from a PDF document — no separate PDF library needed
var pdfResults = BarcodeReader.Read("supplier-invoice.pdf");
foreach (var r in pdfResults)
{
Console.WriteLine($"Page {r.PageNumber}: {r.BarcodeType}: {r.Value}");
}
Imports IronBarCode
' Read from an image file — automatic format detection
Dim imageResults = BarcodeReader.Read("shipping-label.png")
For Each r In imageResults
Console.WriteLine($"{r.BarcodeType}: {r.Value}")
Next
' Read from a PDF document — no separate PDF library needed
Dim pdfResults = BarcodeReader.Read("supplier-invoice.pdf")
For Each r In pdfResults
Console.WriteLine($"Page {r.PageNumber}: {r.BarcodeType}: {r.Value}")
Next
Full documentation for reading options is available in the read barcodes from images guide, covering speed tuning, multi-barcode detection, and image correction settings.
NetBarcode API to IronBarcode Mapping Reference
| NetBarcode | IronBarcode | Notes |
|---|---|---|
new Barcode(data, Type.Code128) |
BarcodeWriter.CreateBarcode(data, BarcodeEncoding.Code128) |
Constructor → static method |
new Barcode(data, Type.EAN13) |
BarcodeWriter.CreateBarcode(data, BarcodeEncoding.EAN13) |
Direct mapping |
new Barcode(data, Type.Code39) |
BarcodeWriter.CreateBarcode(data, BarcodeEncoding.Code39) |
Direct mapping |
new Barcode(data, Type.EAN8) |
BarcodeWriter.CreateBarcode(data, BarcodeEncoding.EAN8) |
Direct mapping |
new Barcode(data, Type.Codabar) |
BarcodeWriter.CreateBarcode(data, BarcodeEncoding.Codabar) |
Direct mapping |
new Barcode(data, Type.Code93) |
BarcodeWriter.CreateBarcode(data, BarcodeEncoding.Code93) |
Direct mapping |
barcode.SaveImageFile("x.png") |
.SaveAsPng("x.png") |
Method rename |
barcode.SaveImageFile("x.jpg") |
.SaveAsJpeg("x.jpg") |
Method rename |
barcode.GetImage() → Image<Rgba32> |
.ToPngBinaryData() or .SaveAsPng() |
No ImageSharp type exposed |
No Type.QRCode |
BarcodeEncoding.QRCode |
New capability |
No Type.DataMatrix |
BarcodeEncoding.DataMatrix |
New capability |
No Type.PDF417 |
BarcodeEncoding.PDF417 |
New capability |
No Type.Aztec |
BarcodeEncoding.Aztec |
New capability |
| No reading API | BarcodeReader.Read(path) |
New capability |
using NetBarcode; |
using IronBarCode; |
Namespace replacement |
using SixLabors.ImageSharp; |
Remove | No longer needed |
using SixLabors.ImageSharp.PixelFormats; |
Remove | No longer needed |
using SixLabors.Fonts; |
Remove | No longer needed |
The complete list of encoding constants is in the supported barcode formats reference.
Common Migration Issues and Solutions
Issue 1: ImageSharp Transitive Dependency Remains After Package Removal
Problem: After running dotnet remove package NetBarcode, dotnet restore shows SixLabors.ImageSharp still present in the dependency tree because another package in the project also references it.
Solution: Run dotnet list package --include-transitive to identify which package is still pulling in ImageSharp. If it is only NetBarcode, removing the explicit package reference and restoring should clear it. If another package is responsible, that package's ImageSharp dependency and its commercial license condition remain in scope independently of the NetBarcode removal.
dotnet list package --include-transitive | grep -i imagesharp
dotnet list package --include-transitive | grep -i imagesharp
Issue 2: Image Type Cannot Be Resolved After Removal
Problem: After removing the SixLabors.ImageSharp package, any variable declared as Image<Rgba32> or parameter typed as SixLabors.ImageSharp.Image<Rgba32> produces a compile error because the type is no longer available.
Solution: Replace each usage with the appropriate IronBarcode output method. If the variable was used to obtain bytes, replace with .ToPngBinaryData(). If it was written to a stream, replace with .SaveAsPng(stream). If it was saved to a file, replace with .SaveAsPng(path).
// Before — requires SixLabors.ImageSharp reference
Image<Rgba32> img = barcode.GetImage();
img.SaveAsPng(stream);
// After — no external image type required
barcode.SaveAsPng(stream);
// Before — requires SixLabors.ImageSharp reference
Image<Rgba32> img = barcode.GetImage();
img.SaveAsPng(stream);
// After — no external image type required
barcode.SaveAsPng(stream);
' Before — requires SixLabors.ImageSharp reference
Dim img As Image(Of Rgba32) = barcode.GetImage()
img.SaveAsPng(stream)
' After — no external image type required
barcode.SaveAsPng(stream)
Issue 3: v1.8 Breaking Change Context
Problem: Codebases that were written against NetBarcode before v1.8 may have GetImage() calls that stored the result without explicit typing, relying on the pre-v1.8 internal return type. These calls may already be broken after a NetBarcode update, independently of the IronBarcode migration.
Solution: Use the IronBarcode migration as an opportunity to resolve any pre-existing v1.8 breakage at the same time. All GetImage() call sites should be located with a project-wide search and replaced with the appropriate IronBarcode output method during the migration pass. The grep commands in the migration checklist below identify these locations.
NetBarcode Migration Checklist
Pre-Migration
Audit all NetBarcode usage before making any changes:
grep -r "using NetBarcode" ./src
grep -r "new Barcode(" ./src
grep -r "Type\.Code128\|Type\.EAN13\|Type\.Code39\|Type\.EAN8" ./src
grep -r "Type\.Codabar\|Type\.Code93" ./src
grep -r "SaveImageFile(" ./src
grep -r "GetImage(" ./src
grep -r "using SixLabors\.ImageSharp" ./src
grep -r "Image<Rgba32>" ./src
grep -r "using NetBarcode" ./src
grep -r "new Barcode(" ./src
grep -r "Type\.Code128\|Type\.EAN13\|Type\.Code39\|Type\.EAN8" ./src
grep -r "Type\.Codabar\|Type\.Code93" ./src
grep -r "SaveImageFile(" ./src
grep -r "GetImage(" ./src
grep -r "using SixLabors\.ImageSharp" ./src
grep -r "Image<Rgba32>" ./src
- Identify every file that requires a using directive change
- Note all
GetImage()call sites and how the returnedImage<Rgba32>object is used downstream - Check whether QRCoder or ZXing.Net are present and can be removed in the same pass
- Run
dotnet list package --include-transitiveto document the current ImageSharp dependency state before removal - Obtain an IronBarcode license key (a free trial key is available without purchase)
Code Update
- Run
dotnet remove package NetBarcode - Run
dotnet remove package SixLabors.ImageSharpif not used by other packages - Run
dotnet add package IronBarcode - Add
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";at application startup - Replace
using NetBarcode;withusing IronBarCode;in each affected file - Remove
using SixLabors.ImageSharp;,using SixLabors.ImageSharp.PixelFormats;, andusing SixLabors.Fonts;from all files - Translate each
new Barcode(data, Type.X)call toBarcodeWriter.CreateBarcode(data, BarcodeEncoding.X)using the API mapping table - Replace
SaveImageFile()withSaveAsPng()or the appropriate format-specific method - Replace
GetImage()calls withToPngBinaryData(),SaveAsPng(), orSaveAsPng(stream)as appropriate - If removing QRCoder: replace
QRCodeGenerator+PngByteQRCodechains withBarcodeWriter.CreateBarcode(data, BarcodeEncoding.QRCode) - If removing ZXing.Net: replace reader setup with
BarcodeReader.Read(path)
Post-Migration Testing
- Build the project and confirm zero compile errors
- Run existing unit tests against generated barcode output
- Visually verify barcode images for correct symbology and legible content
- Verify QR code output if that format was added during migration
- Test reading functionality if barcode scanning was added
- Run
dotnet list package --include-transitiveto confirm ImageSharp is no longer present if it was removed - Validate that the license key initialization runs before the first barcode operation
Key Benefits of Migrating to IronBarcode
Unified Format Coverage: After migration, QR codes, DataMatrix, PDF417, Aztec, and all other 2D formats are available through the same API call used for Code128 and EAN-13. No second library is needed when format requirements expand, and the BarcodeEncoding constant is the only thing that changes between format types.
Built-In Reading: BarcodeReader.Read() handles image files and PDF documents with automatic format detection. Projects that previously required ZXing.Net for reading can remove that dependency and consolidate to a single barcode library, reducing the API surface area that developers on the project must learn.
No ImageSharp Obligation: IronBarcode has no SixLabors.ImageSharp dependency. After migration, the split commercial license condition embedded in NetBarcode's transitive dependencies no longer applies to the project. License compliance reviews become simpler because the barcode library's obligations are stated directly and do not depend on a third-party image processing library's revenue threshold.
Stable Public API: IronBarcode does not expose third-party types in its public API surface. The GeneratedBarcode return type from BarcodeWriter.CreateBarcode is IronBarcode's own type, which means future updates to IronBarcode's internal rendering will not produce breaking changes in calling code the way that NetBarcode's v1.8 GetImage() type change did.
Single Dependency to Maintain: Replacing NetBarcode, QRCoder, and ZXing.Net with IronBarcode reduces three upgrade cycles, three sets of release notes, and three potential version conflicts to one. As .NET versions advance and dependency updates become necessary, the maintenance work scales with a single library instead of three.
Frequently Asked Questions
Why should I migrate from NetBarcode to IronBarcode?
Common reasons include simplifying licensing (removing SDK + runtime key complexity), eliminating throughput limits, gaining native PDF support, improving Docker/CI/CD deployment, and reducing API boilerplate in production code.
How do I replace NetBarcode API calls with IronBarcode?
Replace instance creation and licensing boilerplate with IronBarCode.License.LicenseKey = "key". Replace reader calls with BarcodeReader.Read(path) and writer calls with BarcodeWriter.CreateBarcode(data, encoding). Static methods require no instance management.
How much code changes when migrating from NetBarcode to IronBarcode?
Most migrations result in fewer lines of code. Licensing boilerplate, instance constructors, and explicit format configuration are removed. Core read/write operations map to shorter IronBarcode equivalents with cleaner result objects.
Do I need to keep both NetBarcode and IronBarcode installed during migration?
No. Most migrations are direct replacements rather than parallel operation. Migrate one service class at a time, replace the NuGet reference, and update the instantiation and API call patterns before moving to the next class.
What is the NuGet package name for IronBarcode?
The package is 'IronBarCode' (with capital B and C). Install it with 'Install-Package IronBarCode' or 'dotnet add package IronBarCode'. The using directive in code is 'using IronBarCode;'.
How does IronBarcode simplify Docker deployment compared to NetBarcode?
IronBarcode is a NuGet package with no external SDK files or mounted license configuration. In Docker, set the IRONBARCODE_LICENSE_KEY environment variable and the package handles license validation at startup.
Does IronBarcode detect all barcode formats automatically after migrating from NetBarcode?
Yes. IronBarcode auto-detects symbology across all supported formats. Explicit BarcodeTypes enumeration is not required. If format is already known and performance matters, BarcodeReaderOptions allows restricting the search space as an optimization.
Can IronBarcode read barcodes from PDFs without a separate library?
Yes. BarcodeReader.Read("document.pdf") processes PDF files natively. Results include PageNumber, Format, Value, and Confidence for each barcode found. No external PDF rendering step is required.
How does IronBarcode handle parallel barcode processing?
IronBarcode's static methods are stateless and thread-safe. Use Parallel.ForEach directly over file lists without per-thread instance management. BarcodeReaderOptions.MaxParallelThreads controls the internal thread budget.
What result properties change when migrating from NetBarcode to IronBarcode?
Common renames: BarcodeValue becomes Value, BarcodeType becomes Format. IronBarcode results also add Confidence and PageNumber. A solution-wide search-and-replace handles the renames in existing result-processing code.
How do I set up IronBarcode licensing in a CI/CD pipeline?
Store IRONBARCODE_LICENSE_KEY as a pipeline secret and assign IronBarCode.License.LicenseKey in application startup code. One secret covers all environments including development, test, staging, and production.
Does IronBarcode support QR code generation with custom styling?
Yes. QRCodeWriter.CreateQrCode() supports custom colors via ChangeBarCodeColor(), logo embedding via AddBrandLogo(), configurable error correction levels, and multiple output formats including PNG, JPG, PDF, and stream.

