Solved

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

Posted on 2009-07-09
1
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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