MVC and Less bundles - not working in Release deployed to Azure
Asked Answered
A

1

7

I'm using Dotless and System.Web.Optimizations.LessBundle to include Less stylesheets in my MVC 5 app. Everything is working in Debug and Release on my local machine.

I basically followed the same steps that this blog post did.

My bundle code looks like this:

bundles.Add(new LessBundle("~/Content/css/mySheet").Include(
    "~/Content/lib/normalize/normalize.css",
    "~/Content/site/my/sheet.less"));

In dev locally I end up with a link like this:

http://localhost:57240/Content/site/my/sheet.less

In release locally I end up with a link like this:

http://localhost:57240/Content/css/mySheet?v=zGP7kp7SWQZ0s2SVk555UPp3zcThPaRqzm6bTysZJzE1

But, when I deploy Release build to an Azure website (using Visual Studio publish mechanism) I end up with a link that looks like this:

http://mypage.azurewebsites.net/Content/css/mySheet?v=

As you can see the magic identifier is not appended to the end of the URL.

What gives?

Alley answered 24/2, 2014 at 14:57 Comment(0)
A
6

It turns out I had two issues. The normalize.css file was not included in the project, and therefore not being deployed to Azure. The Less file was returning 404 in the Azure environment, but once it was set to Build Action="Content" it started working. I am not sure why this second thing worked, so I have posted another question.

Alley answered 26/2, 2014 at 16:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.