问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/22047068/why-does-a-less-file-have-to-be-set-as-build-action-content-to-deploy-to-azure