Asp.net-mvc – Sharing assets (images/css/js) between projects using either Visual Studio or TFS

asp.net-mvctfsvisual studio 2012

Is there an effective way to share visual assets between different projects?

This would include images, CSS and JavaScript.

I've looked at the following Stack Overflow questions which don't seem to answer this:

We make use of TFS, not sure if that might have something we can use?

Best Answer

There's nothing built-in ASP.NET MVC that will allow you to generate links to other ASP.NET applications. All the helpers work with relative controller actions for the current application. If all your static files are located inside another ASP.NET application (a sort of custom CDN) then you could define the base location of this application in your web.config and then build custom helpers that will serve those resources:

@Html.Resource("/foo.js", "text/javascript")

and the custom helper will generate an absolute url to this external resource.