Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 554
RationalGeek Avatar asked Feb 24 '14 14:02

RationalGeek


1 Answers

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.

like image 58
RationalGeek Avatar answered Sep 28 '22 07:09

RationalGeek