Techniques For Distributing ASP.NET User Controls Across Projects

Distributing ASP.NET user controls across different projects can be really useful when you want to create a library of controls that can be used by different projects.

Unfortunately, to my knowledge, ASP.NET (2.0 at least) doesn’t support this very cleanly.

The only technique I know of is to add the control to another project, then copy the ascx (and only the ascx, unless you want to extend the control of course) file into the project that references the control, and remove the CodeBehind reference from it.

It works, but it feels hackish.

Does anyone know of a better way to split controls across projects? (perhaps 3.5 helps somehow?)

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You could check out this article by Scott Guthrie:

Building Re-Usable ASP.NET User Control and Page Libraries with VS 2005

Method 2

Check this out: How to share ASP.NET pages and user controls between applications by using Visual C# .NET

You’ll find other resources like this at Google.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x