views:

165

answers:

2

I have a few custom controls that were created as Server Controls projects. I had a few changes to make, so I just added the classes to an existing Web Application project so I could have things in one place. This web app project is compiled into a dll that is used on several web projects.

When I build the web app project and place the dll in the bin of a different website, when I go to use the control I get the following error:

Unknown server tag 'CustomControls:RadioButtonListForGrid'

If I add the custom control classes to the app_code folder of my website it works fine. I used the object browser and confirmed that these classes are in the dll.

Am I missing something obvious here? Do I have to leave these as Server Control projects and combine the dlls using ILmerge?

EDIT

Turns out that I needed to add the assembly name. It also turns out that the assembly wasn't named what I thought it was. Guess I should of checked that. Oops.

+2  A: 

Did you add the tag prefix to web.config?

<pages>
  <controls>
    <add tagPrefix="CustomControls" namespace="MyApp.CustomControls" ...
Robert Harvey
Yes. Also tried at the page level. The same web.config setup works with the classes in the app_code folder, but not compiled in the dll.
ScottE
Have a look at http://www.paraesthesia.com/archive/2007/08/02/generation-of-designer-file-failed-unknown-server-tag.aspx.
Robert Harvey
@Robert Harvey - I've tried with and without the assembly, in all permutations
ScottE
That's very odd. It almost sounds like a versioning problem. I don't suppose restarting the IIS Server is an option.
Robert Harvey
Nope, restarting IIS didn't do the trick. I can get to the namespace in code, so it's there...
ScottE
Well, it turns out I'm an idiot. The web app project had an assembly name that isn't the same as the company portion of <company>.<product>. For whatever reason I do need the assembly name, and it is of course important to know WHAT your assembly name is. I'll mark you as correct for your trouble!
ScottE
A: 

I can confirm it, adding assembly name in the Register directive works! So it's a must even if it's the same assembly.

AugustinJuricic