Solved

Whats the best way to share custom user controls accross mulitple websites / projects

Posted on 2009-07-09
1
190 Views
Last Modified: 2012-05-07
I'm sure theres a simple solution to this, however i'm looking to create a series of controls, all of which can be reused across multiple projects.

The idea is that when i make an improvement to a control,  every other project that shares the control will also see the benefits.

Now Im curious on how i handle html, images, styles etc i.e. should this be present on the projects referencing this control project?

And also whats the best way to implement this from a code standards point of view?

This is quite general i admit - but any advice would be greatly appreciated, along with any working examples, as thats how i tend to understand concepts better?

Thanks
Paul
0
Comment
Question by:paulCardiff
1 Comment
 
LVL 6

Accepted Solution

by:
ahmad2121 earned 500 total points
ID: 24816267
There are two ways:

1. Create a Web Deployement Project

Download for vs 2008:  http://www.microsoft.com/downloads/details.aspx?familyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&displaylang=en

How to set them up and use them: http://www.codedigest.com/Articles/VisualStudio/126_Web_Deployment_Project_for_Visual_Studio_2005_and_2008.aspx

2. Build a regular Web Project, compile it, then use that DLL as a reference (same thing as above basically)

Dealing with HTML and images is pretty easy, For those you could include them in your Web [Deployement] Project as embedded resources, then you can configure them as web resources

Here are instructions on how to set this up:

http://aspnet.4guysfromrolla.com/articles/080906-1.aspx

The benefits of this are:

1. ASP.NET code is precompiled, so you will never have syntax issues
2. Once the DLL for the project is built, you can use it with any project. The WDP is not automatically set as a reference if you include the outputted DLL only, but you can force it as a dependencies for your other projects to make sure it gets compiled first
3. Syntax to use it is very very easy

The downsides:

1. slows down your build time a lot (asp.net code compiles much more slowly)
2. quite a bit of setup involved initially, but once its working its a beauty
3. one other one I forgot, but it can't be that bad :)

Regarding better coding standards, stick to the usual ones. In the end you are going to have a library and you can use that however which way. Figure out what your namespaces will look like, draw it out, draw your dependency lines etc. And as always, when creating libraries, you want to minimize it's dependencies on other modules, and never ever have cyclic dependencies. If a function or a class can be moved to that library, move it rather than including another reference.

Thats pretty much it. Happy coding!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now