I have created a VS2005 Solution, which has one Web Project. The .aspx file in the Web Project makes use of a new User control (.ascx) which is inside a sub-folder of the Web project. When I run the solution, the web project works as expected and the .aspx
renders the user control fine.
Now, using the 'Build->Publish website' option, I have built separate '.dll' libraries for the .aspx file and the .ascx file into a folder named 'output'. These libraries have their names like App_Web_*.dll.
I want to reuse the user control in another web application. So, I tried to reference the .dll that was created above for the user control into the Bin folder of my new web application. After doing so, I am not sure what should be the namespace that I should
include in the 'using' statement in my code behind for the new web app page. I opened the user control's App_Web_*.dll using the ILDASM utility and saw my user control's class name in it. But when I try to create an instance of the user contol class in the
code behind, it is asking for a missing assembly reference. Eventhough I add a reference to the User control's .dll to the Bin, it gives the same error.
Please help. (All I am trying to do is create a reusable user control).
You cannot create a User Control which can be used out of a DLL directly. You have to copy and paste the .ASCX file to the new project. You can use CompositeControls to create a distributable control.
- Sujit
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Please refer to the below posts, I have successfully created a DLL out of a user control and now it is redistributable. This is an easier path compared to developing a custom server control.
I wasn't aware that this is possible. Many thanks.
- Sujit
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
I am also facing in creating user control library (dll). I have created an asp.net web application with only one usercontrol, the application name is "TestControl" and no other projects (like class library) are connected.
When I pubish the project the dll is App_web_*.dll.
techtalktoe
Member
133 Points
136 Posts
Help: Not able to create a User Control library (.dll)
Jul 24, 2007 05:22 PM|LINK
I am trying to create a reusable user control.
I have created a VS2005 Solution, which has one Web Project. The .aspx file in the Web Project makes use of a new User control (.ascx) which is inside a sub-folder of the Web project. When I run the solution, the web project works as expected and the .aspx renders the user control fine.
Now, using the 'Build->Publish website' option, I have built separate '.dll' libraries for the .aspx file and the .ascx file into a folder named 'output'. These libraries have their names like App_Web_*.dll.
I want to reuse the user control in another web application. So, I tried to reference the .dll that was created above for the user control into the Bin folder of my new web application. After doing so, I am not sure what should be the namespace that I should include in the 'using' statement in my code behind for the new web app page. I opened the user control's App_Web_*.dll using the ILDASM utility and saw my user control's class name in it. But when I try to create an instance of the user contol class in the code behind, it is asking for a missing assembly reference. Eventhough I add a reference to the User control's .dll to the Bin, it gives the same error.
Please help. (All I am trying to do is create a reusable user control).
Thanks.
TechTalkToe
"As good as it gets!"
sujitm
Contributor
3153 Points
518 Posts
Re: Help: Not able to create a User Control library (.dll)
Jul 25, 2007 05:54 AM|LINK
You cannot create a User Control which can be used out of a DLL directly. You have to copy and paste the .ASCX file to the new project. You can use CompositeControls to create a distributable control.
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
techtalktoe
Member
133 Points
136 Posts
Re: Help: Not able to create a User Control library (.dll)
Jul 25, 2007 03:43 PM|LINK
Sujit
Please refer to the below posts, I have successfully created a DLL out of a user control and now it is redistributable. This is an easier path compared to developing a custom server control.
http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx and http://blogs.msdn.com/davidebb/archive/2005/10/30/487160.aspx
Thank you for your interest!
TechTalkToe
"As good as it gets!"
sujitm
Contributor
3153 Points
518 Posts
Re: Help: Not able to create a User Control library (.dll)
Jul 26, 2007 06:23 AM|LINK
I wasn't aware that this is possible. Many thanks.
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
shobhasomara...
Member
2 Points
2 Posts
Re: Help: Not able to create a User Control library (.dll)
Feb 01, 2008 06:34 AM|LINK
Hi,
I am also facing in creating user control library (dll). I have created an asp.net web application with only one usercontrol, the application name is "TestControl" and no other projects (like class library) are connected.
When I pubish the project the dll is App_web_*.dll.
Why is it so?
Thanks
Shobha