Visual Studio团队服务在构建期间编译的脚本较少

时间:2023-01-16 21:55:40

I'm deploying an ASP.NET Web Application to an Azure Website using VSTS's Continuous Integration. Everything works great except compiling LESS files.

我是部署一个ASP。NET Web应用程序到Azure网站使用VSTS的持续集成。除了编译较少的文件之外,一切都很好。

I looked through the build steps and I couldn't find anything specific to LESS. Is there any documentation on how to do this?

我查看了构建步骤,没有找到任何特定于LESS的东西。有关于如何做到这一点的文件吗?

1 个解决方案

#1


2  

It's pretty easy actually. You just have to set it's build action property to "content" and everything should be good to go.

其实很简单。你只需将它的build action属性设置为“content”,一切都应该很好。

If that doesn't do the trick, I found this blog post detailing another method to try (note that I haven't tried this technique myself yet):
In Visual Studio, open the properties of your web project, go to the "Build Events" section, and the in the section "Post-build event command line", insert the following line:

如果不奏效,我发现这篇文章详细介绍另一种方法尝试(注意,我还没有尝试过这种方法):在Visual Studio中,打开您的web项目的性质,“构建事件”一节,和“Post-build事件命令行”一节中,插入以下行:

$(SolutionDir)\packages\dotless.1.1.0\Tools\dotless.Compiler.exe -m "$(ProjectDir)\content\*.less" "$(ProjectDir)\content\*.css"

Every time the project builds, this command will compile any .less file in the \content folder into a corresponding .css file, minifying it as well (with the -m switch).
Here is the post that contained this information: http://tech-journals.com/jonow/2011/05/13/using-less-css-with-asp-net

每次项目构建时,这个命令都会将\content文件夹中的任何.less文件编译成相应的.css文件,并将其缩小(使用-m开关)。以下是包含这一信息的帖子:http://techjournals.com/jonow/2011/05/13/usingless css-with-asp-net。

#1


2  

It's pretty easy actually. You just have to set it's build action property to "content" and everything should be good to go.

其实很简单。你只需将它的build action属性设置为“content”,一切都应该很好。

If that doesn't do the trick, I found this blog post detailing another method to try (note that I haven't tried this technique myself yet):
In Visual Studio, open the properties of your web project, go to the "Build Events" section, and the in the section "Post-build event command line", insert the following line:

如果不奏效,我发现这篇文章详细介绍另一种方法尝试(注意,我还没有尝试过这种方法):在Visual Studio中,打开您的web项目的性质,“构建事件”一节,和“Post-build事件命令行”一节中,插入以下行:

$(SolutionDir)\packages\dotless.1.1.0\Tools\dotless.Compiler.exe -m "$(ProjectDir)\content\*.less" "$(ProjectDir)\content\*.css"

Every time the project builds, this command will compile any .less file in the \content folder into a corresponding .css file, minifying it as well (with the -m switch).
Here is the post that contained this information: http://tech-journals.com/jonow/2011/05/13/using-less-css-with-asp-net

每次项目构建时,这个命令都会将\content文件夹中的任何.less文件编译成相应的.css文件,并将其缩小(使用-m开关)。以下是包含这一信息的帖子:http://techjournals.com/jonow/2011/05/13/usingless css-with-asp-net。