4

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?

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for reply! That's one more approach, but resources would be copied to each project, which means that client will download same shared images, css & js files once for each web site. There is one more approach using only web application projects, described here: blogs.msdn.com/b/webdevtools/archive/2006/07/01/652986.aspx . But it has it's cons too - visual studio does not have full support for that and shows warnings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.