IRONSOFTWAREHOME

Using IronBarcode with AI Coding Assistants and Agents

Curtis Chau
Curtis Chau
Updated: September 21, 2026

When prompted to add IronBarcode, tools often run dotnet add package IronBarcode, which installs the incorrect package. IronBarcode is distributed as BarCode, using the namespace IronBarCode. Claude Code, ChatGPT Codex, GitHub Copilot, Cursor, and Google Antigravity frequently misidentify this until they reference the documentation.

This confusion also affects generated code. Without documentation, models may invent method names that do not compile. Providing documentation in advance helps ensure successful builds. IronBarcode is a leading .NET barcode library with comprehensive guides, so generated code is often accurate but still requires careful review.

These tools fall into two categories, which determine how closely you should review their output:

  • An assistant operates within one part of your workflow, such as editor autocomplete, explanations, or quick refactoring, as GitHub Copilot's inline suggestions do.
  • An agent manages multi-step tasks, edits across files, runs builds and tests, and opens pull requests, as Claude Code, ChatGPT Codex, Cursor, and Google Antigravity all do.

The setup process is the same for both types. Install the package, apply the license key from an environment variable, provide IronBarcode's machine-readable documentation, and verify that every generated barcode is scannable. This applies to all use cases, including 1D barcodes for shipping labels, 2D barcodes for asset tags, barcodes built from text, URLs, IDs or binary data, reading from scanned PDFs, or extracting multiple symbols from one image.

Claude Code AI coding agent logoChatGPT Codex AI coding agent logoGitHub Copilot AI coding assistant logoCursor AI code editor logoGoogle Antigravity AI coding agent logo

Can't the Model Handle Barcodes on Its Own?

Training data ages. A model may reproduce an API name that was retired several releases ago, or one belonging to a different barcode library entirely, and neither is visible until the build runs. Machine-readable documentation resolves most of these issues by enabling the tool to reference actual documentation rather than making assumptions.

Library selection is equally important. Most tools integrate with various barcode packages, and free options may suffice for a single format in a demonstration. Additional costs and limitations often arise in production environments:

  • Check digits, quiet zones, and resizing: each can look acceptable on screen and still fail during scanning, so IronBarcode validates every value against its format as it writes and GeneratedBarcode.Verify reads the image back.
  • Missing features increase code maintenance: many free libraries cover one format family or lack the image correction accurate scans require, leaving you to combine packages and own the integration between them.
  • Bulk scanning is included by default: multithreaded reading, speed presets, and confidence thresholds come with the library rather than being built per project.
  • Accurate output depends on documentation: the guides, tutorials, troubleshooting pages, and runnable examples are indexed for machine use in llms.txt.
  • Incorrect package names create supply-chain risks: models generate plausible names that attackers register to distribute malware, a practice known as slopsquatting.
  • A single commercial license avoids legal complications: some barcode libraries include copyleft or non-commercial terms, which models do not flag automatically.

IronBarcode covers all of it through one API and one commercial license your legal team reviews once. Verification happens in your code rather than on the warehouse floor, and naming the package explicitly in every prompt is what closes the supply-chain gap.


Step 1: Install IronBarcode

Allow the agent to add the package. The project requires it to resolve types and provide accurate code suggestions.

Set this project up for IronBarcode. The NuGet package is named BarCode. Confirm the restore succeeded before going further.
Text

Alternatively, install the package from the terminal, specifying the current release version.

dotnet add package BarCode --version 2026.9.2
SHELL

Linux, macOS, iOS, and Android each require a specific package, such as BarCode.Linux or BarCode.MacOs. Refer to the Advanced NuGet Installation guide to select the appropriate package.


Step 2: Apply Your License Key

IronBarcode does not watermark unlicensed output. After the development grace period, the first barcode call without a license key throws IronSoftware.Exceptions.LicensingException with the message IronBarcode must be licensed for development. Code missing the license key will fail at runtime. Obtain a free trial key first.

Start using IronBarcode in your project today with a free trial.

First Step:
arrow pointer

Set the license key once at application startup, before any IronBarcode calls. Retrieve the key from the environment rather than from source code.

// Read the key from configuration. Never commit it to the repository.
IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_LICENSE_KEY");
C#

IronBarCode.License.IsLicensed returns true when the key is valid. Unlike IronOCR, IronBarcode has no Installation.LicenseKey alias, so use License.LicenseKey or configuration.

Please note: Every other way to set a key, from Web.config to appsettings.json, is covered in IronBarcode License Keys.

Step 3: Point the Tool at IronBarcode's LLM Documentation

IronBarcode publishes six resources written to be read by machines:

ResourceDescriptionWhen to use
llms.txtIndex of all documentation pages, one line eachAt the start of every session
llms-full.txtComplete guides and examples in a single fileThe tool can retrieve URLs
llms-full-catalog.txtThe index plus all blog articlesThe answer may reside in a blog article
API ReferenceAll classes and methods in the current releaseVerifying that a method exists
skill.mdInstallation, licensing, recipes, and fixesYour tool supports skill files
AI Product Fact SheetProduct scope, platforms, and what it does not doQuestions about the product, not the API

Begin with llms.txt, which indexes IronBarcode's features and the location of each topic. This helps prevent incorrect or invented API calls. Use llms-full.txt when detailed guidance is required.

Add a direct instruction alongside it.

Before writing any IronBarcode code, read https://ironsoftware.com/barcode/csharp/llms.txt
and use only APIs documented there. Check anything you are not sure about
against the API reference at https://ironsoftware.com/barcode/csharp/object-reference/api/.
If you are still unsure whether a method exists, ask instead of guessing.
Text

Current models respond well to direct requests for clarification. Asking a question is preferable to risking a compile error.

Please note: IronBarcode also publishes a drop-in skill file for tools that support them. The next step covers where to reference it.

Step 4: Add IronBarcode Context to Your Project

Documentation pasted into a chat is available only for the current session. Documentation stored in a project file is accessible in every session.

Each tool reads instructions from a specific file. Place the IronBarcode guidance in the file your team uses:

ToolProject context fileSkill file goes in
Claude CodeCLAUDE.md.claude/skills/
ChatGPT CodexAGENTS.md.agents/skills/
GitHub Copilot.github/copilot-instructions.mdn/a
Cursor.cursor/rules/*.mdcn/a, use @Docs
Google AntigravityAGENTS.md.agents/skills/

AGENTS.md serves as a shared standard, as Claude Code, GitHub Copilot, and Cursor all read it in addition to their own files. Teams using multiple tools can maintain a single set of barcode rules in AGENTS.md and reserve native files for tool-specific instructions.

The content remains the same regardless of the file used. Below is a brief starting point.

## Barcodes with IronBarcode

This project uses IronBarcode (NuGet package `BarCode`, namespace `IronBarCode`) for all barcode work.

- Reference: https://ironsoftware.com/barcode/csharp/llms.txt
- Skill file: https://ironsoftware.com/barcode/csharp/skill.md
- Use `BarcodeWriter.CreateBarcode` to write and `BarcodeReader.Read` / `ReadPdf` to read.
- Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. Never inline it.
- Every generated barcode must be read back and compared before it ships.
- Do not use a different barcode library. If IronBarcode cannot perform a required task, state this clearly.
Text

The skill.md file provides additional detail, including per-platform installation instructions, licensing rules, verified examples, deployment notes, and a troubleshooting table. Reference this file from your context file rather than maintaining a separate copy.


Step 5: One-Shot Setup Prompt

You may also send the first four steps as a single prompt at the beginning of a project or new session.

Use IronBarcode for all barcode work in this project.

1. Install the BarCode NuGet package (IronBarcode).
2. Apply the license key at application startup, before any other IronBarcode call,
   reading it from the IRONBARCODE_LICENSE_KEY environment variable. Never write
   the key into source or into a committed file.
3. Read https://ironsoftware.com/barcode/csharp/llms.txt before writing barcode code
   and work only from APIs documented there, checking the API reference when a
   member is unfamiliar.
4. Save https://ironsoftware.com/barcode/csharp/skill.md as a SKILL.md in this
   project's skills folder if your tool has one.
5. Keep these instructions for future sessions in this project.
Text
Tips: That last line usually makes the tool save these rules to its context file from Step 4, such as CLAUDE.md or AGENTS.md. You only paste the prompt once.
Tips: No test images? Ask the agent to generate them with IronBarcode first, then read them back. A barcode library is one of the few things an agent can test end to end in text alone. It writes a value, decodes the image, and compares the strings.

Step 6: Prompt Patterns That Produce Working Code

Ambiguous prompts often result in weak output. The following three patterns help ensure clarity.

Name the class and the symbology: IronBarcode handles dozens of formats. A reader that knows which ones to expect works faster and misreads less.

Vague Scan the barcodes in this image with IronBarcode.

Better Using BarcodeReader.Read with BarcodeReaderOptions, read the Code 128 and QR codes in this image and return each value with its format.

Specify the version and framework: APIs change between releases, and omitting the version can cause inconsistencies. Release 2026.9.2 introduced EciMode, which controls whether a 2D barcode carries a UTF-8 ECI header and is not available in 2026.8.6 or earlier.

Better Target .NET 9 and BarCode 2026.9.2. Include the license key line, read from the environment.

Request the complete runnable file: Code fragments may omit necessary using statements or setup steps.

Better Give me the complete Program.cs, including all using statements and license key setup, so I can run it as-is.


Step 7: Verify What You Get Back

Review generated code as you would a first draft from a colleague who has not executed it. Four checks address most issues:

  1. It compiles: an invented method fails right away.
  2. The license key is applied: it must be set before the first IronBarcode call, or that call throws LicensingException.
  3. Each API method exists: consult the API reference for any unfamiliar method before seeking alternatives.
  4. Every barcode can be read: decode each generated image with BarcodeReader or GeneratedBarcode.Verify and compare the result to the input.

The fourth check exists because the compiler cannot detect an unreadable barcode.

Be aware of the following common issues in generated IronBarcode code:

  • The wrong package name: the opening paragraph covers this, and it remains the most repeated mistake.
  • Enum casing inconsistencies: BarcodeEncoding.Databar and BarcodeWriterEncoding.DataBar belong to different enums and differ by one capital letter.
  • Methods borrowed from other barcode libraries: a model may combine APIs from several sources into methods that do not exist.
  • Invented reader options: check any unfamiliar option against the reading speed options and crop region guides.

Let the Agent Verify Its Own Work

An agent can perform all four checks independently. Request evidence for each check rather than a summary.

Build and run the project in Release mode. Confirm that every IronBarcode member used
appears in the documentation, that IronBarCode.License.IsLicensed returns true, and
that every barcode you generated reads back to the value you wrote. Report the build
result and a table of written value, read value, and format from the run itself.
Text

A Result You Can Reproduce

This section evaluates an agent using a realistic task and a single prompt, with no code provided by you. Run it in a new session on an empty project and judge the outcome against the criteria below.

Please note: Before you start, you need the .NET 9 SDK, an AI coding agent that can run commands, an internet connection, and an IronBarcode trial or production key in the IRONBARCODE_LICENSE_KEY environment variable. IronBarcode throws an error instead of watermarking when there is no key, so this test cannot pass without one.

The prompt

Build a .NET 9 minimal API for shipping labels with two endpoints: GET /label/{trackingNumber} returns a Code 128 PNG with the value printed below the bars, and POST /scan accepts an uploaded image and returns every barcode it contains as JSON (value and format). Work start to finish alone: write, build, run, and fix, making sensible assumptions where anything is unspecified. Save every deliverable to the project root.

1. Install the BarCode NuGet package pinned to version 2026.9.2.
2. Read from https://ironsoftware.com/barcode/csharp/llms.txt and the pages it links to, using only APIs documented there.
3. Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. If IronBarCode.License.IsLicensed is false, stop and report that instead of continuing.
4. Generate a test set of 12 barcodes into a testset folder: 4 Code 128 tracking numbers, 3 QR codes carrying order URLs, 3 DataMatrix codes carrying GS1 element strings, and 2 EAN-13 codes with correct check digits. Name each PNG after its format and index.
5. Implement /scan with BarcodeReaderOptions narrowed to those four formats and ExpectMultipleBarcodes enabled.
6. Build in Release, run the API, call /label for one tracking number, then POST every testset image and the /label output to /scan.
7. Write roundtrip.md: a table of file, written value, read value, format, and match. All 13 must match; if any do not, fix the cause and run again.
8. Finish with a short report: build result, match count, and assumptions made.
Text

Output

Code 128 shipping label for tracking number 1Z999AA10123456784, returned by GET /label in the acceptance test run

This is the original PNG returned by GET /label/1Z999AA10123456784 during the recorded run. The round-trip table from the same run lists all 13 images with their written and decoded values.

What passes

  • The Release build completes without manual intervention.
  • roundtrip.md shows 13 of 13 matching rows, each read value matching what was written and each format correct.
  • Both EAN-13 values carry valid check digits, and the GS1 strings come back unchanged.
  • The license key comes from the environment and appears nowhere in source or in roundtrip.md.
Please note: Pin the version to match your own project by swapping the release in step 1 for the one you target. The IronBarcode changelog lists what changed in each release.

The run record

ItemValue
PackageBarCode 2026.9.2
Target framework.NET 9
Agent and modelClaude Code, Opus 5
MachineWindows 11 x64, Intel Core i9-14900KF, 64 GB RAM
ResultRelease build passed, 13 of 13 round trips matched
Reference outputlabel.png, roundtrip.md
Last testedSeptember 16, 2026

One compilation fix was required during the run, and no code was manually edited.


Agent-Specific Guides

The setup above works with any of them. Each guide below adapts it to one tool:


Troubleshooting


Questions?

If you have any questions, reach out to support@ironsoftware.com

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

Ready to Get Started?

Nuget Downloads 2,468,794Version:2026.9just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package BarCode
nuget.org/packages/BarCode/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronBarCode"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronBarCode to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronBarCode.dll"

Licenses from $999

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.

OR
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 IronBarcode
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
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package BarCode
nuget.org/packages/BarCode/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronBarCode"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronBarCode to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronBarCode.dll"

Licenses from $999