Skip to content

Commit 6a81c0f

Browse files
author
KB Bot
committed
Added new kb article resolve-compile-time-error-radpdfprocessing-telerik-reporting
1 parent a94c0b2 commit 6a81c0f

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Resolving Compile Time Error with Telerik.Documents.Fixed and Telerik.Reporting after Upgrading to Q4 2024
3+
description: This article explains how to solve the compile time error caused by conflicting types between RadPdfProcessing and Telerik.Reporting when upgrading to Q4 2024.
4+
type: how-to
5+
page_title: Fixing Compile Time Error Between Telerik.Documents.Fixed and Telerik.Reporting after Upgrading to Q4 2024
6+
slug: resolve-compile-time-error-radpdfprocessing-telerik-reporting-net-9
7+
tags: radpdfprocessing, document processing, .net 9, compile time error, size conflict, extern alias
8+
res_type: kb
9+
ticketid: 1670534
10+
---
11+
12+
## Environment
13+
14+
| Version | Product | Author |
15+
| --- | --- | ---- |
16+
| 18.3.24.1112| Telerik.Reporting|[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)|
17+
|2024.4.1106|RadPdfProcessing (.NET Standard)||
18+
19+
## Description
20+
21+
If you have the **Telerik.Reporting** NuGet package (**18.3.24.1112**) installed simultaneously with the **Telerik.Documents.Fixed** NuGet package, a compile time error occurs:
22+
23+
The type 'Size' exists in both 'Telerik.Documents.Core, Version=2024.4.1106.20, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' and 'Telerik.Reporting, Version=18.3.24.1112, Culture=neutral, PublicKeyToken=a9d7983dfcc261be'
24+
25+
>note This undesired behavior is not reproducible with the previous version of Telerik Reporting. It is caused due to the fact that Telerik.Documents.Primitives.Size is contained in both assemblies/packages with the same namespace.
26+
27+
## Solution
28+
29+
To resolve the compile time error caused by the conflicting 'Size' type in both assemblies, use the C# **extern alias** feature. Follow these steps to implement the solution:
30+
31+
1. **Assign Aliases to the NuGet Packages**: Assign an alias to each conflicting NuGet package in your project. For Telerik.Documents.Fixed, use `DPLHelper`, and for Telerik.Reporting, use `ReportingHelper`.
32+
33+
2. **Use Extern Alias in Your Code**: At the top of your source file, add the `extern alias` directive for each alias you assigned. This differentiates the namespaces, allowing you to use types from both assemblies without conflict.
34+
35+
3. **Adjust Your Code to Use the Aliased Namespaces**:
36+
37+
```csharp
38+
extern alias DPLHelper;
39+
extern alias ReportingHelper;
40+
41+
using DPLHelper::Telerik.Windows.Documents.Fixed.Model.Editing;
42+
using DPLHelper::Telerik.Windows.Documents.Fixed.Model;
43+
44+
namespace YourNamespace
45+
{
46+
internal class Program
47+
{
48+
static void Main(string[] args)
49+
{
50+
RadFixedDocument fixedDocument = new RadFixedDocument();
51+
RadFixedPage fixedPage = fixedDocument.Pages.AddPage();
52+
fixedPage.Size = new Telerik.Documents.Primitives.Size(210,297);
53+
FixedContentEditor fixedEditor = new FixedContentEditor(fixedPage);
54+
}
55+
}
56+
}
57+
```
58+
59+
This approach allows you to explicitly specify which 'Size' class to use, thereby resolving the compile time error and allowing your project to build successfully.
60+
61+
## See Also
62+
63+
- [Telerik Document Processing Libraries Overview](https://docs.telerik.com/devtools/document-processing/introduction#available-assemblies)
64+
- [Feedback Portal Entry for Compile Time Error in Q4 2024](https://feedback.telerik.com/reporting/1670554-compile-time-error-occurs-after-upgrading-to-q4-2024)
65+
- [Extern Alias C# Documentation](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias)

0 commit comments

Comments
 (0)