Why does a LESS file have to be set as Build Action "Content" to deploy to Azure?
Asked Answered
D

1

6

I have an Azure website. I also have dotless running in my MVC app to translate and bundle Less files. When I deploy a release build to Azure, the Less file returns 404 unless I set it to Build Action="Content" in it's properties. Once I change that setting, everything works as expected.

So, I no longer have an issue, except I don't understand why it has to be set to Content. Can someone explain?

Danielledaniels answered 26/2, 2014 at 16:16 Comment(1)
As far as I know, the build action has to be set to content so that the compiler/publishing process will include the file in the published files. I believe if you look at css, js, image files, they are all set to content as well.Cuspidate
C
6

Build Action="Content" tells the publishing process that this file should be copied as-is to the destination.

It's there so you don't bring along all your source files, readme files and other associated "developer fluff" when you're trying to publish the output of the build process. It's an opt-in process to make sure you don't bring anything sensitive by accident, like a private key.

Most item templates in Visual Studio set their Build Action to the right thing for you by default, generally so well that you don't even think about this until a template doesn't get this right and you wonder where your files are.

Constellate answered 26/2, 2014 at 16:25 Comment(1)
Thanks. I guess it was the second part about VS automatically setting most things to Content that had me confused.Danielledaniels

© 2022 - 2024 — McMap. All rights reserved.