IRONSOFTWAREHOME
MIGRATION GUIDES

Migrating from NetBarcode to IronBarcode

Curtis Chau
Curtis Chau
Updated: August 1, 2026

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);

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");

IronBarcode vs NetBarcode: Feature Comparison

FeatureNetBarcodeIronBarcode
1D barcode generationYesYes
2D barcode generation (QR, DataMatrix, PDF417, Aztec)NoYes
Barcode reading from imagesNoYes
Barcode reading from PDF documentsNoYes
1D format count1130+
2D format count08+
Total symbologies1150+
GS1-128, GS1 DataBarNoYes
Postal formatsNoYes
SVG outputNoYes
Batch processingManualBuilt-in
ImageSharp dependencyYes (split license)No
Commercial supportCommunityProfessional
License modelMIT (+ 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
SHELL

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
SHELL

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;

Add license initialization once at application startup - in Program.cs, Startup.cs, or the project's entry point:

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");

IronBarcode Approach:

using 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");

IronBarcode Approach:

using 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();

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);

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));

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");

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

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.Format}: {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.Format}: {r.Value}");
}

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

NetBarcodeIronBarcodeNotes
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.QRCodeBarcodeEncoding.QRCodeNew capability
No Type.DataMatrixBarcodeEncoding.DataMatrixNew capability
No Type.PDF417BarcodeEncoding.PDF417New capability
No Type.AztecBarcodeEncoding.AztecNew capability
No reading APIBarcodeReader.Read(path)New capability
using NetBarcode;using IronBarCode;Namespace replacement
using SixLabors.ImageSharp;RemoveNo longer needed
using SixLabors.ImageSharp.PixelFormats;RemoveNo longer needed
using SixLabors.Fonts;RemoveNo 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
SHELL

Issue 2: Image<Rgba32> 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);

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
SHELL
  • Identify every file that requires a using directive change
  • Note all GetImage() call sites and how the returned Image<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-transitive to document the current ImageSharp dependency state before removal
  • Obtain an IronBarcode license key (a free trial key is available without purchase)

Code Update

  1. Run dotnet remove package NetBarcode
  2. Run dotnet remove package SixLabors.ImageSharp if not used by other packages
  3. Run dotnet add package IronBarcode
  4. Add IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"; at application startup
  5. Replace using NetBarcode; with using IronBarCode; in each affected file
  6. Remove using SixLabors.ImageSharp;, using SixLabors.ImageSharp.PixelFormats;, and using SixLabors.Fonts; from all files
  7. Translate each new Barcode(data, Type.X) call to BarcodeWriter.CreateBarcode(data, BarcodeEncoding.X) using the API mapping table
  8. Replace SaveImageFile() with SaveAsPng() or the appropriate format-specific method
  9. Replace GetImage() calls with ToPngBinaryData(), SaveAsPng(), or SaveAsPng(stream) as appropriate
  10. If removing QRCoder: replace QRCodeGenerator + PngByteQRCode chains with BarcodeWriter.CreateBarcode(data, BarcodeEncoding.QRCode)
  11. 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-transitive to 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.

Please note: NetBarcode, QRCoder, and ZXing.NET are registered trademarks of their respective owners. This site is not affiliated with, endorsed by, or sponsored by NetBarcode, QRCoder, or ZXing.NET. All product names, logos, and brands are property of their respective owners. Comparisons are for informational purposes only and reflect publicly available information at the time of writing.
Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Related Articles

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required