Resolving Namespace Conflicts in Telerik Document Processing Libraries
Environment
| Version | Product | Author |
|---|---|---|
| 2024.4.1106 | Telerik Document Processing | Desislava Yordanova |
Description
When a .NET Core project uses both the .NET Standard and .NET Framework versions of a Document Processing library (for example, Telerik.Documents.Spreadsheet and Telerik.Windows.Documents.Spreadsheet), a namespace conflict occurs because the Workbook class exists in both packages. This conflict causes a compiler error that prevents successful compilation.

Do not install the .NET Standard and .NET Framework versions of the Document Processing libraries simultaneously in the same project. Install the NuGet package that is compatible with the application's target framework and target OS.

This article also answers the following questions:
- How do you resolve type conflicts in .NET Core projects that use Telerik Document Processing libraries?
- What is the correct way to handle namespace conflicts when you use Telerik Document Processing in mixed .NET environments?
- How do you use the C#
extern aliasfeature to differentiate between similar types in different assemblies?
Solution
Depending on the target framework of your project (.NET Framework, .NET Standard, .NET 8, .NET 9 and .NET 10, and so on), install the matching library version. If you need to install both versions, use the C# extern alias feature to resolve the compile-time error caused by the conflicting Workbook type. This approach lets you differentiate between assemblies and use types from both without conflict. Follow these steps:
-
Assign Alias to NuGet Packages
- For the
Telerik.Documents.SpreadsheetNuGet package, set its alias toStandardHelper(or any preferred alias). - For the
Telerik.Windows.Documents.SpreadsheetNuGet package, set its alias toFrameworkHelper(or any preferred alias).


- For the
-
Use Extern Alias in Your Code
- At the top of your source file where you intend to use the conflicting types, add the
extern aliasdirective for each alias you assigned. This directive differentiates the assemblies and allows you to reference each type explicitly.
- At the top of your source file where you intend to use the conflicting types, add the
extern alias StandardHelper;
//extern alias FrameworkHelper;
using StandardHelper::Telerik.Windows.Documents.Spreadsheet.Model;
//using FrameworkHelper::Telerik.Windows.Documents.Spreadsheet.Model;
namespace YourNamespace
{
internal class Program
{
static void Main(string[] args)
{
Workbook workbook;
}
}
}
These steps resolve the namespace conflict and allow you to use the Workbook class from the desired NuGet package in your .NET Core project.