Reputation: 2158
I have an asp.net mvc 3 project that uses Razor. I am able to store the views in a shared library, but I also want to store additional resources like images, stylesheets and javascript files in a shared library. So my question is:
How can I store stylesheets, javascript and images in a shared library?
Upvotes: 3
Views: 803
Reputation: 1038720
If you want to share static resources such as images, stylesheets and javascript files between multiple projects I would recommend you creating a separate web application that will host those resources and which will be accessed by all other applications. A sort of CDN if you will. The benefit of a CDN is that all applications have a single location for those static resources meaning that clients of all applications will have those resources in cache.
If you want to store them in a separate assembly that would mean that each application will have a different copy of them => clients of your applications won't benefit from this caching. You could still do it if you will. Simply embed those resources into the library and then write a controller action that will read them and serve them.
Upvotes: 4