bundling virtual paths in areas

301 Views Asked by At

I want to create a style bundle with following virtual path (plugin framework):

"~/Areas/Domain.PluginTest.Wui/Bundles/PluginCss"

When I go to that path I get an error stating that the file doesn't exist. The Static file handler is trying to find a file. How can I make this work with bundling?

System.Web.HttpException
Message:

File does not exist.
Stack trace:

at System.Web.StaticFileHandler.GetFileInfo(String 
virtualPathWithPathInfo, String physicalPath, HttpResponse response) at 
System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String 
overrideVirtualPath) at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext 
context, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.
HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, 
Boolean& completedSynchronously)
1

There are 1 best solutions below

0
On

The bundler is trying to find your path ~/Areas/Domain.PluginTest.Wui/Bundles/PluginCss, which doesn't exist. This is why we generally prefix bundle paths with bundles

bundles.Add(new StyleBundle("~/bundles/Areas/Domain.PluginTest.Wui/Bundles/PluginCss")
       .Include());