Why does the message BC30560 'mymodule_ascx' is ambiguous in the namespace 'ASP' come up sometimes then go away?

I recently came across this problem and it was only happening on one server even though all were running the same code. I thoroughly investigated the problem to make sure there were no user controls with clashing names, temp files were cleared out, etc.

The only thing that solved the problems (it seems permanently) is changing the batch attribute of the compilation element to false in the web.config, as suggested in the following link:

http://personalinertia.blogspot.com/2007/06/there-bug-in-compiler.html

<compilation debug="true" batch="false">

I firmly believe that this is in fact a bug in the compiler as suggested on that site.


I just solved this problem with the assistance following link: http://www.netomatix.com/development/usercontrols2.aspx

In a nutshell, your class is called MyModule. However, if you do not specify the ClassName property in the @Control directive, the compiler may append _ascx to the control's class, which results in MyModule_ascx. Since the page can't find MyModule_ascx, it blows up in your face. You need to explicitly tell it the ClassName...

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MyModule.ascx.vb" ClassName="MyModule" %>

Another possibility:

http://channel9.msdn.com/forums/TechOff/157050-BC30560-mycontrolascx-is-ambiguous-in-the-namespace-ASP/

Seemed to have some success with changing

src="mycontrol.ascx.cs"

to

CodeBehind="mycontrol.ascx.cs"

Tags:

Asp.Net