Tutorial :ASP.Net Forms “type exists in both dll1 and dll2” error in Debug mode but not Release mode


In a website project targeted for the .Net Framework 3.5 I occasionally get an error like the following:

The type 'ASP._myetc_master' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\site\3a65eca7\73f2d86b\App_Web_myetc.master.cdcab7d2.iefhoqis.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\site\3a65eca7\73f2d86b\App_Web_myetc.master.cdcab7d2.tgrvlldi.dll'

This error often pops up after updating a backend library that the data access layer for the site relies upon, and crops up in pages that rely on those objects. I have removed the Temporary ASP.Net Files folder in question, and have also removed and re-added the references in question and deleted the contents of my /bin directory. None of those things seem to have any effect (although the last time I encountered the problem clearing the references seemed to resolve the issue).

I only encounter the error when building in the Debug configuration - when building in the Release configuration the error doesn't occur.

Any pointers to where else I might look for a cause or solution would be highly appreciated.


OK, I think I resolved it. Here's what I think the scoop is:

My solution is structured so that I have a data access layer project that references an integration layer with our ERP system. The web project references the data access layer. I had the integration layer also referenced in the web project, so in essence it was being included twice; once by the DAL and once by the web project. Removing the reference at the web project layer resolved the issue.

I am still a little confused as to why the error message pointed to duplication in a master page and not in the objects provided by the integration layer. I am also confused as to why the web project built fine when in Release mode but not in Debug mode. Nevertheless, my specific problem appears to be resolved.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »