A: 

One option is to try "Add existing" and in the dialog that appears, the OK button has a drop arrow next to it, change it to Add with a link.

If that doesn't work, rewrite your controls as Custom Controls.

It will take a little while, but will make it much more maintainable in the future.

ck
A: 

In order to share controls between web apps, the only way I found was to either rewrite them into server controls or to use virtual directory to make the user controls actually in folder be in each project.

Unfortunately, asp.net doesn't really have a good solution for this. The same is true for sharing master pages.

Jacob Adams
A: 

hey this is not the best way to do things but i used to do this in my asp.net 1.1 days - you can try this - shift your user controls into a seperate project, and publish this project as a virtual directory under iis

as long as you are not using codebehind - your updates would be cool (only update shared user control folder)

if you do use codebehinds - redeploy the user control dlls into different projects


once you are done with this - map these user controls into all projects using their virtual paths

check these links - http://aspadvice.com/blogs/ssmith/archive/2006/10/05/Tip_3A00_-Share-User-Controls-Between-Applications-in-ASP.NET.aspx

AND

http://www.123aspx.com/redir.aspx?res=30887

Raj
+5  A: 

The way we do it at my present company is to make sure CommonControlsWebApp is a WebApplication, not a web site. Then you use names for the folders that would help identify it as the common ones that are distinct from the individual web apps. (CommonUserControls instead of just UserControls)

In your other web apps, you create a virtual directory to the CommonUserControls, etc, and add a file based reference to the CommonControlsWebApp.dll

This requires you to use IIS for development (not casini), and Visual Studio won't believe that the controls really exist, but it will work at runtime, and you can build just fine with only warnings about blahblah.ascx or blahblah.master path invalid.

If you do use common master pages and Visual Studio 2008, you will need SP1 for 2008 and use a __fallback.master in the root of the individual web projects to go in to design mode.

However, I saw this on another thread, and I am going to look into doing more like this: http://webproject.scottgu.com/CSharp/UserControls/UserControls.aspx

wulimaster
using IIS for development over cassini is a *good thing*
annakata
A: 

You might consider using source control and sharing your controls at that level. We do this for a sizable user control library and it works quite well.

Using SourceGear Vault but you should be able to do this with any source control product.

Andrew Robinson
But won't this require me to commit any changes made in the library to make them available in the other projects?
Jan Aagaard
Yes. They are either shared across projects or they are copied. Can't have it both ways.
Andrew Robinson
If you don't want them all shared, they have a "shared controls" folder and a (non-shared) "controls" folder.
Andrew Robinson
A: 

Check this post for how to solve this issue.

The basic idea is to change your project to have a prebuild step to copy over the .ascx files to a subdirectory of the web application. Then just refer to those copies when using them. Of course you also need to reference the UserControls assembly as well.

Daniel
+2  A: 

You could compile it into a dll

Turning an .ascx User Control into a Redistributable Custom Control

Brief Outline of the Steps

The basic steps to make this happen are as follows:

  1. Write your user control as you normally would, typically using the Visual Studio designer.
  2. Test it using a simple page before trying to deploy it.
  3. Deploy the application to precompile it.
  4. Grab the user control's assembly produced by the deployment step, and you're essentially done: You have your custom control.
  5. Finally, use your custom control in other apps

Further info here http://www.nathanblevins.com/Articles/Compile-a-Web-User-Control-into-a-DLL-.Net-c-.aspx

Aidan
Thanks a lot for the links.
Jan Aagaard