0

I'm trying to add a precompiled dll to my webform project. The dll is a precompiled user control (not server control). When I tested the user control during development on a webform in that project everything worked fine. I then removed the web form so that only the user control remained and published it to file. Next, in the project I want to use this in, I added a reference to the dll and made sure there's a copy of it in the bin folder for the using project.

I'm not sure, but I think my problem is understanding exactly what goes in web.config (or the Registration tag), this is what I have for a Register tag:

<add assembly="CustomStatusNavigator" namespace="CustomStatusNavigator" tagPrefix="Custom" />

... where "CustomStatusNavigator is both the name of the user control project and the namespace containing my .cs code.

The error I'm getting is

The type or namespace name 'CustomStatusNavigator' does not exist in the namespace 'CustomStatusNavigator' (are you missing an assembly reference?)

Am I doing something blatantly wrong? Is it just a myth that a custom USER control can be converted to a dll and used like a custom control? Grateful for any help / pointers, good links. I have googled the heck out of this.

1 Answer 1

1

See the Custom controls are different and the User Controls are different.

When we create user control,the scope is limited to that application only.Say suppose we are creating one user control named as 'Test.ascx'. It can be used throughout the application by registering to just below the page directive. Remember.It won't create any .dll file,it must be only .ascx.

In case of custom control,you can create your own control with the help of available server controls. you can compile them and at this point the dll file will be generated for the same.

This dll file can be useful in another projects also but for that purpose you have to add reference of it to any new project.

After adding the reference of it,you can see it under the tools and can simply drag and drop the same whenever you want to use it.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks siddesh. I spoke to a programmer at work about it and walked away with the understanding that the user control must have an ascx file somewhere in the project to which it's being added to, even if it was precompiled and the dll referenced. Decided to go the server control route. It's a steeper learning curve, but it's coming along pretty well and certainly worth the effort. Appreciate the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.