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>
The glob keeps new language files in sync without touching project references whenever the folder changes.

