Skip to content

Commit e4532d8

Browse files
Merge pull request #483 from telerik/new-kb-resolve-compile-time-error-radpdfprocessing-telerik-reporting-b15175b7872f46c0b726ba1414b96b8d
Added new kb article resolve-compile-time-error-radpdfprocessing-telerik-reporting
2 parents a94c0b2 + 1f95c67 commit e4532d8

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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
7+
tags: pdfprocessing, document, processing, compile, error, size, conflict, extern, alias, reporting
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](https://docs.telerik.com/reporting/introduction) 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. Select the Telerik.Documents.Fixed NuGet package and set its Alias to DPLHelper (or whatever you want):
32+
33+
![DPLHelper](images/DPLHelper.png)
34+
35+
1. Select the Telerik.Reporting NuGet package and set its Alias to ReportingHelper (or whatever you want):
36+
37+
![ReportingHelper](images/ReportingHelper.png)
38+
39+
1. **Use Extern Alias in Your Code**: At the top of your source file, add the [extern alias`](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias) directive for each alias you assigned. This differentiates the namespaces, allowing you to use types from both assemblies without conflict.
40+
41+
1. **Adjust Your Code to Use the Aliased Namespaces**:
42+
43+
```csharp
44+
extern alias DPLHelper;
45+
extern alias ReportingHelper;
46+
47+
using DPLHelper::Telerik.Windows.Documents.Fixed.Model.Editing;
48+
using DPLHelper::Telerik.Windows.Documents.Fixed.Model;
49+
50+
namespace YourNamespace
51+
{
52+
internal class Program
53+
{
54+
static void Main(string[] args)
55+
{
56+
RadFixedDocument fixedDocument = new RadFixedDocument();
57+
RadFixedPage fixedPage = fixedDocument.Pages.AddPage();
58+
fixedPage.Size = new Telerik.Documents.Primitives.Size(210,297);
59+
FixedContentEditor fixedEditor = new FixedContentEditor(fixedPage);
60+
}
61+
}
62+
}
63+
```
64+
65+
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.
66+
67+
## See Also
68+
69+
- [Telerik Document Processing Libraries Overview]({%slug introduction%})
70+
- [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)
71+
- [Extern Alias](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias)

0 commit comments

Comments
 (0)