Skip to main content
A newer version of this page is available. .
All docs
V21.2

Type 'X' exists in both assemblies / Type 'X' is ambiguous in namespace 'Y'

  • 2 minutes to read

Error Description:

This error occurs because .NET does not allow you to reference assemblies with the same name but different versions in one project. When you try to open a page or compile an application, the framework tries to load older assemblies that are already replaced with new assemblies.

Solution:

Follow the steps below to solve this issue:

  1. Close Visual Studio.

  2. Use the DevExpress Temporary ASP.NET Files Clearer to clear the following “Temporary ASP.NET Files” directories (you can clear these directories manually):

    • C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
    • C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\
    • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\
    • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\
    • C:\Users[your_user_name]\AppData\Local\Temp\Temporary ASP.NET Files\
  3. Restart the “World Wide Web Publishing” service (Start menu\Settings\Control Panel\Administrative tools\Services).

  4. Clear the project’s Bin and Obj folders and deploy new assemblies (optional).

  5. Find the App_Licenses.dll file within your solution and delete it (if this file exists).

  6. If you use a custom theme, use the Project Converter to update a custom theme project. Generate a new theme assembly, add it into your application, and remove the old theme assembly.

  7. Rebuild your application.

  8. If you use any Version Control System (for example, Git or Microsoft TFS), check whether your repository contains unused libraries and remove them from this repository.

See Also: Upgrade Notes

Could not load file or assembly ‘X’

To resolve this issue, first, try recommendations from the previous section: Type ‘X’ exists in both assemblies / Type ‘X’ is ambiguous in namespace ‘Y’ issue.

Ensure that you copied DevExpress assemblies into the web site’s Bin folder after the website is deployed on the production machine. You can use the DevExpress Assembly Deployment Tool to deploy assemblies.

See also: