Free Support Forum - groupdocs.com

Compilation Error after referencing Viewer and Annotation dll


#1

Server Error in ‘/’ Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type ‘Groupdocs.Web.UI.Viewer’ exists in both ‘c:\Users\spadmin\AppData\Local\Temp\2\Temporary ASP.NET Files\root\3409236a\622cdc0a\assembly\dl3\f4a42d3c\00105c06_43d3cf01\Groupdocs.Web.Annotation.DLL’ and 'c:\Users\spadmin\AppData\Local\Temp\2\Temporary ASP.NET Files\root\3409236a\622cdc0a\assembly\dl3\dd499cb2\8e1e0892_afdccf01\Groupdocs.Viewer.DLL’

Source Error:

Line 5:  
Line 6:
Line 7: <%= Groupdocs.Web.UI.Viewer.CreateScriptLoadBlock()%>
Line 8:
Line 9:

#2

Hello Hiren,

We are sorry to hear that you have this issue. From your description we see that you want to use GroupDocs.Viewer for .NET and GroupDocs.Annotation for .NET in a single ASP.NET WebForms application.

This is possible, but because GroupDocs.Viewer and GroupDocs.Annotation have the same namespaces, there is a conflict, incompatibility between them. In order to resolve it you need to use aliases.

First of all, you need to assign different aliases for GroupDocs.Viewer and GroupDocs.Annotation in the “Solution Explorer” -> “References” tab.

Then in the C# source files you need to declare (extern alias ViewerAlias;) and then use (using ViewerA = ViewerAlias::Groupdocs.Web.UI;) these aliases.

We suggest you to read these articles, if you have troubles with aliases:
1. How to: Use the Global Namespace Alias (C# Programming Guide)
2. 9.3.1 Using alias directives
3. extern alias (C# Reference)
4. Extern alias walkthrough

If you will have more questions please feel free to contact us.