Shared code between multiple Asp.Net projects

What is the best practice for sharing the bin and dll folder and other resource files (like css) between multiple web applications on the same server?

I have already separated the common code from my own assemblies, but I'm curious about deployment, etc. I basically want to have all the common files located in ONE location on the web server, and then each web application link to this shared location.

I'm currently not sure how to tell Asp.net to use the bin folder from another location.

If that matters, these are ASP.NET MVC applications.

Thanks for the help.

+4
source share
3 answers

Best practice suggests that you do not.

Each application is different, consider it as such. By sharing resources, you create an implicit dependency between projects - if you change a shared resource that you change for everyone - regardless of whether it was intended or not.

If you really need to share resources, do it at the version control or assembly level - itโ€™s much easier to break the dependency at this level than to break the dependency after deployment on a production server.


Xanadont , sharing shared libraries, etc. (these are essentially open source projects, such as nHibernate), but doing this at the level of the exchange folders on the server on the production server creates more problems than it solves. The reuse types you are talking about are best suited for creating shared libraries that are independent projects in the source control with supported binary versions. Projects that want to use shared libraries then take a binary dependency in the shared library by copying the binary to the lib folder in the decision source tree and referencing that binary. This allows you to maintain and update shared libraries without causing side effects due to direct dependencies on them, and solutions that use libraries can evaluate fixes / updates to determine how they will affect code that depends on them, and if the update worth it.


Scott , what you mean is application 1 with changes in presentation level (templates), not 50 applications with changes in business logic . The best approach for this type of application is multi-user (since I assume you have 1 database for each city) and use the URL to determine the context from which you can access your database and decide your browsing paths ( it's hard to describe a better approach that doesn't understand your application architecture better).

Changing URL-based views can be done by implementing a context-sensitive viewer (see http://www.coderjournal.com/2009/05/creating-your-first-mvc-viewengine/ for an example of how to do this is.

With this approach, you only have 1 place that you need to update with corrections, but you can easily create a new โ€œsiteโ€ for another city by simply adding a new set of templates and (depending on how you set up the routing) indicating The new domain on your site. If you have a set of default templates, your browsing mechanism may even return to them if the settings do not exist, so you can set up a new site simply by specifying a new domain in your application.

+1
source

I use the following method: I have several ASP.net application projects with ascx controls, resources, etc ... I have implemented a virtual path provider to allow virtual paths between these applications. It works very well. I also implemented a special http handler for uploading files. If you need samples, check out the liveui source code.

0
source

All Articles