This is a new MVC5 project, created from the blank ASP.NET template.
Here's my bundle registration:
Imports System.Web.Optimization
Public Class BundleConfig
Public Shared Sub RegisterBundles(Bundles As BundleCollection)
Bundles.Add(New StyleBundle("~/styles/main").Include("~/Styles/Layout.css"))
End Sub
End Class
...here's the relevant section of my view:
@Code
Me.Layout = Nothing
End Code
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
@Styles.Render("~/styles/main")
</head>
... and here's the HTML output:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<link href="/styles/main" rel="stylesheet"/>
</head>
Note that the link's href should instead be:
<link href="/Styles/Layout.css" rel="stylesheet"/>
All of this of course results in a 404
error.
Things I've tried:
- Followed the general guidance from the official documentation
- Added a
CssRewriteUrlTransform
object, as indicated here - Both enabled and disabled Optimization, as indicated here
- Updated the
WebGrease
package to the latest version - Checked
Web.config
for anumbracoReservedPaths
key, as indicated here (none exists) - Added
Bundles.IgnoreList.Clear()
as indicated here
This exact construct is working correctly in another project, so obviously something's different. But I'm unable to spot it.
How can I get this bundle to render properly?