Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs
Contact   •   Articles   •   Products   •   Support   •   Search
Ad-free experience sponsored by:
ASPOSE - the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more

Watch out for web.config Build Provider errors and Custom Controls on Toolbox


:P
On this page:

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:

 

<buildProviders>

      <add extension=".wwpd" type="System.Web.Compilation.PageBuildProvider" appliesto="Web"/>

      <add extension=".wcsx" type="System.Web.Compilation.PageBuildProvider" appliesto="Web"/>

</buildProviders>

 

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>)…


The Voices of Reason


 

Karl
March 27, 2006

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Yes indeed, you saved me 20 mins if not more!

Thank you.

Paul
May 13, 2006

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

oh man,you just saved me a couple hours (if not days reinstalling the whole thing...)
thank you so much!

Bryon Barnard
May 24, 2006

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Thanks. This saved me more than 20 mins for sure.

THANKS.
Bryon

Bhavin
May 31, 2006

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Thanks. That worked like a charm.

Shahab-o-ddin Mokhtari
July 30, 2006

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Hi,
WOW...Thanks! You've helped me just like always!

Thnx

Steve Falzon
September 07, 2006

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Hi Rick, thanks for this info, saved me alot of time and that's very much appeciated.

On the msdn site the example for buildProviders still contain the appliesTo attribute though the schemas don't, so I was a bit confused.

Thanks again

Steve

# DotNetSlackers: Watch out for web.config Build Provider errors and Custom Controls on Toolbox


keyes
January 20, 2007

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

thank you - it did the trick

keyes

software786
February 03, 2007

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

In ASP.NET 2.0 AJAX Extensions 1.0 (Released 1/2007), the following got rid of the above error message when I added the following to my Web.Config:

<httpHandlers>
<!-- The following line is needed for adding AJAX to an existing web site -->
<add verb="GET" path="ScriptResource.axd"
type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false"/>
</httpHandlers>

<httpModules>
<!-- The following lines are needed for adding AJAX to an existing Website -->
<add name="WebResourceCompression" type="Microsoft.Web.Handlers.WebResourceCompressionModule,
Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add name="ScriptModule" type="Microsoft.Web.UI.ScriptModule,
Microsoft.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>

But, when I launched my website, I got another error message from the debugger on this line:

<add name="WebResourceCompression" type="Microsoft.Web.Handlers.WebResourceCompressionModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

This is probably a version error, because the example from where I picked up the above was for a Beta version.

Sincerely,

software786
I will let you know as soon as I can pin down

# 黑暗執行緒: KB-VS 2005中拖入自訂網頁控制項時出現錯誤


Duncan Ion
March 17, 2007

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

I had something similar.
I've organised my DotNetNuke development environment so that I develop my modules as individual projects. In my solution I have a DotNetNuke website as a tertiary project.
The physical location of the files in each module/project is under the "Desktopmodules" directory of the website.
When I added a control to the project I got the "Control cannot be created...." and the control [an Infragistics control] created a new web.config file in the root of the project!
With nothing else in it except the assemblies entries, it was bound to fail.....

The solution was to:
a) delete the newly created web.config file
b) close the project [ascx] files
c) open the SAME files, but under the website structure...

Worked fine then.

rotovibe
March 24, 2007

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Also,
For AJAX.NET D&D problems...
If there were previous versions of AJAX.net within the config file, remember to remove them. I ran into the drag and drop problem when the first node it comes accross within the assemblies node is:

"<add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>"

Not the current namespace. Threw fits when I updated my dev environment to the new ajax release and tried to D&D. I had to manually remove the old assembly node.
All is well when I entered the correct assembly node attributes.

黑暗執行緒
June 07, 2007

# 黑暗執行緒: 2006/12


Joel
December 12, 2007

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Hi guys,


After converting my Ajax site to WAP, I started have this issue. After trying EVERYTHING on the web, I finally found a solution that works for me. Since the DLL's get compiled all into the parent directory, I needed a way to reference the AjaxControlToolkit in my child projects. This is very simple, once you figure it out.

1) Add a reference to AjaxControlToolkit.

2) Each Webform needs to have the line below explicitly registering the assembly.

<%@ Register Assembly="AjaxControlToolkit, Version=1.0.10920.13360, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


Presto! I can add the controls again fine.

Noli San Jose
December 18, 2007

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

A different solution works for me:

<a href="http://aspdotnet6976.blogspot.com/2007/12/control-cannot-be-created-because.html">
http://aspdotnet6976.blogspot.com/2007/12/control-cannot-be-created-because.html</a>


Noli

Alex Romero
January 16, 2008

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Actually in my case i developed a few controls out side the main solution, after registering the custom controls in the GAC i tried to use them in my main solution but to my surprise this error poped up. The reason, i had 1 control developed first and added to the main solution then a 2nd one came along. At some point between installing the first and the second control the web config got corrupted having 2 lines with the same directions and different version of the dll. Your post helped a lot cus instead of rebuilding my dll i went directly to the config file and searched for something wrong. As soon as i deleted the extra line it started working.

Thanks a lot you saved me days of re work.

Mike Westermann
April 11, 2008

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

Just quitting VS and restarting worked for me.

Code Charm
October 09, 2009

# Error: "Control cannot be created because Visual Studio cannot find the control's type in the control's assembly"

I was working on a .NET 2.0 Web Application, and had attempted to add a ScriptManager control to a Master page from the Toolbox, from the ASP.NET AJAX Extensions (1.6.0something). ...

Prashant Srivastava
April 24, 2010

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

hi,


I am facing a problem in redirecting a aspx page to asp page , when i searched on google the solution came to change in web config file for <buildProviders> i have done that also but even though the same error is coming :

There is no build provider registered for the extension '.asp'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

Amar Karandikar
August 17, 2011

# re: Watch out for web.config Build Provider errors and Custom Controls on Toolbox

I faced a similar issue.
However the root cause of something different.
I wanted to add ListView control to my application.
I had VS 2005 open on my system. I saw that tool box didn't have the ListView control, so selected "Choose Items" option and selected the "ListView" control from the resulting dialog.

However i didn't notice the version of the dll while chosing 3.5.0.0.
As I understand this will create version incompatibility.

So when I dragged the component on to the form it started giving me the error
"Control cannot be created because Visual Studio cannot find the control's type in the control assembly".
HTH,
Amar

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2020