Type 'X' exists in both assemblies / Type 'X' is ambiguous in namespace 'Y'
- 2 minutes to read
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.
Follow the steps below to solve this issue:
Close Visual Studio.
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\
Restart the “World Wide Web Publishing” service (Start menu\Settings\Control Panel\Administrative tools\Services).
Clear the project’s Bin and Obj folders and deploy new assemblies (optional).
Find the App_Licenses.dll file within your solution and delete it (if this file exists).
Rebuild your application.
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.