Geeks With Blogs
Matt Watson Software developer, product visionary, and master of #dadops

Sharing User Controls across projects is something everyone needs to do.

You create this great thing in Project A and need to use it in Project B.

The best way I have found to do it is with virtual directories in IIS, or sub-projects in sub-folders.

Basically you create one project as a control/class library, but provide no functionality in it, no web.config, no global asax, and NO “Application” in IIS. Take this project and stick it at inetpub\wwwroot\ControlLibrary.

Then in your other projects you create a virtual directory of  “ControlLibrary” that points back to inetpub\wwwroot\ControlLibrary. All you have to do in your other projects is have a reference to the ControlLibrary.dll, or a project reference in one solution. Then just load the control with a Page.LoadControl() and pass in “ControlLibrary\SomeFolder\SomeControl.ascx”

Good Luck!

Posted on Thursday, October 9, 2003 2:38 PM | Back to top


Comments on this post: Sharing User Controls across projects.

# re: Sharing User Controls across projects.
Requesting Gravatar...
Hey! Thats great. I have been searching for an approach to sharing my components across projects.

I shall try this.

Thanks
Left by sumeer on Feb 28, 2005 11:33 PM

# re: Sharing User Controls across projects.
Requesting Gravatar...
This worked fine. Thanks. I do have one question. What did you mean by "or a project reference in one solution"
Left by ron on Dec 09, 2005 5:01 AM

Your comment:
 (will show your gravatar)


Copyright © Matt Watson | Powered by: GeeksWithBlogs.net