Assembly with USER controls (ascx) cannot find its resources




I built an assembly with a set of user controls.
This can be done with the Visual Studio 2005 Deployment Project:
building and merging for example all your aspx and ascx in one dll
(lets say BunchOfUserControls.dll)
Doing so it's possible to resuse user controls in other web projects
without transferring the ascx files. Just the dll.
The reason I need this is because I need to load dynamicly controls in
a website.
This works fine.
The only thing to keep in mind is that it's not possible to use your
own class name.
Supose your user control is named MyNameSpace.MyUserControl the final
dll will contain a class named ASP.<name sub folder>_MyUserControl_ascx
This class is derived from my own class and overrides the
FrameworkInitialize method in order to render the ascx declarative
<name sub folder> is the folder were I've got my user controls in the
original solution.
So creating the user control dynamicly you need to do the following:

Assembly assembly = Assembly.Load("BunchOfUserControls");
object instance =

This works fine. The page shows correcly the user control.

And now my problem: I need to localize my controls. Just created resx
files for some languages and used the same technique to create my
Web deployment project creates an assembly for the resources:
Running the system again it produces an error after adding my control
to the page: cannot find resouce file.
After inspecting the resource dll (with Reflector) I see all my user
controls, however the've got the original names (MyUserControl). The
user control dll (with Reflector) shows mysubfolder_myusercontrol_ascx.
So I guess there is a problem matching the two.

The main question is: how can a merge my user controls into one dll and
still use the local resource files with meta:resourcekey="blabla"
declarations in the original ascx controls?

Kind regards,


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads