Monday, Jun 5, 2006, 12:49 PM in Tools
Web Application Project: "The type 'foo' exists in both 'some dll' and 'another dll'"
In using the most excellent Web Application Project support for ASP.NET 2.0 in VS05 from Mr. Guthrie and co, I ran into what was first an intermittent and then a constant problem that actually made it's way onto my live site (it worked on my machine!). The error looked like this against several classes in my app, i.e. when I'd comment out one, I'd get another class that showed the same problem:
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 'ASP.clientredirector_ascx' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\sb2\4d76034e\bec2c8d0\App_Web_clientredirector.ascx.cdcab7d2.zmdrab5k.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\sb2\4d76034e\bec2c8d0\App_Web_axhgbqrn.dll'
Source Error:
|
Line 11: |
Source File: d:\project\mine\sb2\pageLayout.ascx Line: 13
I chased this with my ISP a few days ago, but futzing with it made it go away mysteriously. When it came back, it came back with a vengeance and I pulled in every ASP.NET 2.0 resource I could think of to fix it, including sending ScottGu the FTP user name and password to sellsbrothers.com (my site hasn't fit into a reasonable .zip file for a while now : ).
The thing I did that fixed the problem (seemingly consistently), came from Scott himself; I added the batch="false" attribute to my compilation element in my web.config file:
<configuration ...>
<system.web>
<compilation ... batch="false"/>
...
Apparently this ends up generating a lot more assemblies than 'batch="true"', but I don't know why that would fix the problem or even what's causing the problem. This never happens in WinForms or Avalon (and, of course, neither of those technologies have issues of their own... : ).
Thanks Scott, Ting-Hao, Simon and David!
Update: Microsoft has updated the Knowledge Base with this issue