Skip to content

Commit d0f12a4

Browse files
committed
new KB - Resolving Ambiguous references
1 parent 6a0ca32 commit d0f12a4

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

knowledge-base/dpl-resolve-ambiguous-references.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article describes how to resolve ambiguous references due to c
44
type: how-to
55
page_title: How to Resolve Ambiguous References
66
slug: dpl-resolve
7-
tags: radspreadprocessing, document processing, wpf, ambiguous reference, extern alias
7+
tags: spreadprocessing, document, processing, wpf, ambiguous, reference, extern, alias
88
res_type: kb
99
ticketid: 1684241
1010
---
@@ -17,16 +17,23 @@ ticketid: 1684241
1717

1818
## Description
1919

20-
When developing a WPF application that utilizes RadSpreadProcessing for Document Processing to set a font in a spreadsheet, and the solution includes a cross-platform project referencing `Telerik.Documents.Core`, an ambiguous reference error may occur. The issue arises due to identical namespaces in both assemblies when both platform-specific projects and cross-platform projects are part of the solution. This knowledge base article also answers the following questions:
21-
- How to resolve ambiguous reference errors in a WPF project using RadSpreadProcessing?
22-
- How to use RadSpreadProcessing in a WPF application with cross-platform project references?
23-
- How to set a spreadsheet font in WPF using RadSpreadProcessing without ambiguous references?
20+
When developing a WPF application that utilizes [RadSpreadProcessing]({%slug radspreadprocessing-overview%}) to set a font in a spreadsheet, and the solution includes a cross-platform project referencing `Telerik.Documents.Core`, an ambiguous reference error may occur.
21+
22+
![Ambiguous Error](images/ambiguous_error.png)
23+
24+
The issue arises due to identical namespaces in both assemblies when both platform-specific projects and cross-platform projects are part of the solution.
2425

2526
## Solution
2627

27-
To resolve the ambiguous reference error in a WPF application using RadSpreadProcessing alongside a cross-platform project, use the `extern alias` directive. This approach allows differentiating between assemblies that have the same namespace but are intended for different platforms. Follow the steps below to apply this solution:
28+
The Telerik Document Processing libraries are available in .NET Framework, .NET 8/.NET 9 (or newer) for Windows and .NET Standard compatible versions. All versions are available as NuGet packages. The assemblies/packages for .NET Standard do not contain the word *Windows* in their name. Learn [What Versions of Document Processing Libraries are Distributed with the Telerik Products]({%slug distribute-telerik-document-processing-libraries-net-versions%}).
29+
30+
In a WPF project, you need to use the assemblies containing the word *Windows* and avoid mixing .NET Framework and .NET Standard compatible versions.
31+
32+
However, to resolve the ambiguous reference error in a WPF application using RadSpreadProcessing alongside a cross-platform project, use the [extern alias](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias) directive. This approach allows differentiating between assemblies that have the same namespace but are intended for different platforms. Follow the steps below to apply this solution:
33+
34+
1. **Assign an alias to the conflicting assembly in the WPF project**. Right-click on the referenced assembly in the Solution Explorer and select `Properties`. In the `Aliases` field, enter a unique alias (e.g., `NetFramework`).
2835

29-
1. **Assign an alias to the conflicting assembly in the WPF project**. Right-click on the referenced assembly (`Telerik.Documents.Core` in the cross-platform project) in the Solution Explorer and select `Properties`. In the `Aliases` field, enter a unique alias (e.g., `NetFramework`).
36+
![NET Framework Aliases](images/framework_aliases.png)
3037

3138
2. **Use the `extern alias` directive in your WPF project code**. At the top of your C# file where you are facing the ambiguous reference, declare the alias defined in step 1. This explicitly specifies which assembly to use for the conflicting types.
3239

@@ -55,7 +62,6 @@ By following these steps, you can successfully resolve the ambiguous reference e
5562

5663
## See Also
5764

58-
- [Telerik Document Processing Introduction](https://docs.telerik.com/devtools/document-processing/introduction)
59-
- [What Versions of Document Processing Libraries are Distributed with the Telerik Products](https://docs.telerik.com/devtools/document-processing/knowledge-base/distribute-telerik-document-processing-libraries-net-versions)
60-
- [Resolve Compile-Time Error Between RadPdfProcessing and Telerik Reporting](https://docs.telerik.com/devtools/document-processing/knowledge-base/resolve-compile-time-error-radpdfprocessing-telerik-reporting)
65+
- [What Versions of Document Processing Libraries are Distributed with the Telerik Products]({%slug distribute-telerik-document-processing-libraries-net-versions%})
66+
- [Resolve Compile-Time Error Between RadPdfProcessing and Telerik Reporting]({%slug resolve-compile-time-error-radpdfprocessing-telerik-reporting%})
6167
- [C# Extern Alias - Microsoft Documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias)
39.4 KB
Loading
31.5 KB
Loading

0 commit comments

Comments
 (0)