New to Telerik Document Processing? Download free 30-day trial

Resolving FileNotFoundException for System.Text.Encoding.CodePages in RadWordsProcessing

Version Product Author
2024.2.426 RadWordsProcessing Desislava Yordanova

Description

When using the RadWordsProcessing in a WPF/WinForms project which targets .NET 6.0 , a System.IO.FileNotFoundException error may occur, stating that the file for assembly 'System.Text.Encoding.CodePages, Version=7.0.0.0' could not be found. This issue arises while utilizing the Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider.

WPF project Net6

Encoding CodePages Error

Solution

To resolve the FileNotFoundException for 'System.Text.Encoding.CodePages' in a .NET 6.0 project using RadWordsProcessing, follow these steps:

  1. Right-click on your project to select it and edit .csproj file.

Edit proj file

  1. Include the necessary PackageReference entry for System.Text.Encoding.CodePages and add a FunctionsPreservedDependencies entry for it.
<ItemGroup>
  <PackageReference Include="Telerik.Windows.Documents.Flow" Version="2024.2.426" />
  <PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
  <FunctionsPreservedDependencies Include="System.Text.Encoding.CodePages.dll" />
</ItemGroup>

Add PackageReference

By adding these entries to your .csproj file, the required package references will be included in your project, resolving the FileNotFoundException.

Notes

Ensure that your project targets the appropriate .NET 6.0 framework and that all NuGet package versions are compatible with your project setup.

See Also

In this article