Question

I need to share those types of resources across several ASP.NET web sites. The approach I tend to is to create separate web application for common master pages and separate web site for common CSS, images, etc. The problem here is that I will no more be able to reference common resources using tilde, instead I would have to use URL of common web site with those resources.

There is also an approach delegating source control to manage this which I don't like because you would have to check in changes and update other web sites for changes to take effect.

Are there any better ways of sharing those resources across ASP.NET web sites?

Was it helpful?

Solution

You could add the common resources project to your solution, set up a pre-build event command line in the common resources project to copy the files to a directory in the solution you are working in and then create a project reference to the common resources project so it will copy each time you build the project that needs the resources.

I use it to share ASP.NET Usercontrols between a few projects. The idea is described here: http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx.

Here is an example what you can put in the pre-build event in the common resources project:

if exist $(SolutionDir)\SharedDir\ xcopy $(ProjectDir)\Resources\*.* $(SolutionDir)\SharedDir\ /c /y /d
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top