2

I found that under ASP.NET MVC 4 you can't define a bundle of Javascripts or CSSs if their virtual path is managed by a VirtualPathProvider. I mean, if directory "~/Static/" is mapped to a VPP you can't Include("~/Static/Stylesheets/themes/dark-blue.css") because it will simply and silently fail.

From here and here it really looks like this is the default behaviour of runtime, because it basically resolves the virtual path on file system rather than using ASP.NET pipeline. And, fortunately, it's to be implemented in next MVC.

Anyway, since this looks like being a common problem, and since I'm going to store static resources outstide of the project (ultimately on Azure's CDN, but I still have to develop&debug), did anyone find a workaround to let ASP.NET Web Optimization search for resources in their virtual paths?

usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305
  • Similar question here: http://stackoverflow.com/questions/12100524/how-do-i-get-system-web-optimization-bundles-to-work-with-custom-folders-in-an-i - the OP mentions IIS virtual directories but I believe they are the same of my case – usr-local-ΕΨΗΕΛΩΝ Dec 29 '12 at 21:59

1 Answers1

1

VirtualPathProvider support is in the 1.1-alpha1 version of Optimization, have you tried that version out? It should support resolving files through your VPP.

Hao Kung
  • 28,040
  • 6
  • 84
  • 93
  • I know you are working on System.Web.Optimization : good job ! Do you think the alpha can be used on production ? (can't find the backlog for the alpha). Have you got a release date for the 1.1 ? because i am really interested by the VirtualPathProvider feature. – Cybermaxs Feb 12 '13 at 10:08