I just spent 20 minutes trying to figure out why I was unable to drop a custom control onto a Web Page in ASP.NET 2.0. I’ve been going back and forth between ASP.NET 2.0 beta installs and in one of my applications the same controls worked just fine, but in this app trying to drag the controls from the toolbox simply gave an error:
Control cannot be created because Visual Studio cannot find the control’s type in the control assembly
This error would lead you to believe that there’s something wrong with your control’s assembly or the control class itself.
Not so. This error apparently occurs whenever a control cannot be dropped and the reasons for this are many.
In my case the problem was that my Web.Config was invalid and had an invalid build provider config setting:
<add extension=".wwpd" type="System.Web.Compilation.PageBuildProvider" appliesto="Web"/>
<add extension=".wcsx" type="System.Web.Compilation.PageBuildProvider" appliesto="Web"/>
The appliesto=”Web” is no longer legal in post beta 2 builds and this caused the control to no longer work. Once I removed the appliesto – presto all is well.
My application clearly pointed me at that error – kudos for VS.NET to do that – but it’s not quite obvious while you’re working on your form that a Web.config setting can affect your control dropping ability.
Hopefully this will help somebody out and save you 20 minutes (then again if you are searching for it – it’s probably easily been 20 minutes so far <g>)…
Other Posts you might also like