Missing Secondary Language Files in ClickOnce Publishes

A .NET 8.0 console app that uses IronOCR with a secondary language pack (Spanish, Japanese, and so on) runs fine inside Visual Studio but throws at runtime once published with ClickOnce. The language data files never make it into the publish output.

IronOcr.Exceptions.LanguagePackException:
Please install the Nuget Package IronOcr.Languages.Spanish...
Error: 'The file Spanish.ocrdata was not found'

ClickOnce only publishes what it explicitly knows about. Secondary language .ocrdata files are not recognized or bundled automatically, so they are silently dropped from the deployment even though the package is installed.

Solution

Mark the language pack files for publishing so ClickOnce carries them into the deployment. Pick whichever option fits your project.

Option 1: Mark Each File as Content

Locate the .ocrdata files in your build output, typically:

bin\Debug\net8.0\OcrData

For every file inside the OcrData folder, set:

  • Build Action: Content
  • Copy to Output Directory: Copy if newer

That copies the files to the build folder and pulls them into the ClickOnce publish process.

Option 2: Include Them in the .csproj

When the folder is auto-generated or large, edit the .csproj to pick up every .ocrdata file recursively instead of managing each one in the UI:

<ItemGroup>
  <Content Include="OcrData\**\*">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
</ItemGroup>
<ItemGroup>
  <Content Include="OcrData\**\*">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
</ItemGroup>
XML

The glob keeps new language files in sync without touching project references whenever the folder changes.

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 6,106,091 | Version: 2026.7 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronOcr
run a sample watch your image become searchable text.