2

我有一个 ASPNET Core 3.1 MVC Web 应用程序。我在项目中添加了一个 .SCSS 文件,并在构建项目时安装了WebCompiler Visual Studio 扩展来编译 SCSS 文件。我已启用自定义构建步骤,以便运行dotnet build将运行 WebCompiler 并生成.css输出文件。

我现在正在尝试通过 Github Actions 自动执行此操作,并且 WebCompiler 在构建过程中失败:

Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 5.66 sec for /home/runner/work/ndc-expo/ndc-expo/project.csproj.

  WebCompiler: Begin compiling compilerconfig.json
  WebCompiler installing updated versions of the compilers...
/home/runner/.nuget/packages/buildwebcompiler/1.12.394/build/BuildWebCompiler.targets(12,9):
   error : No such file or directory [/home/runner/work/ndc-expo/ndc-expo/project.csproj]

Build FAILED.

/home/runner/.nuget/packages/buildwebcompiler/1.12.394/build/BuildWebCompiler.targets(12,9):
  error : No such file or directory [/home/runner/work/ndc-expo/ndc-expo/project.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:07.57
##[error]Process completed with exit code 1.

尝试在本地复制构建(带有 dotnet sdk 3.1 的 Ubuntu 20.04)会产生相同的错误 - 所以我猜 WebCompiler 只是简单地在 Linux 上不起作用......有人知道启用或解决这个问题的方法吗?所有项目文档都说它具有“对 CI 场景的 MSBuild 支持”——没有明确说明我是否应该期望它与 Linux 一起工作。

4

1 回答 1

0

也许尝试更改为这个WebCompiler作为 dotnet 工具来编译 sass 文件。然后,您可以将它与 Github Actions 一起使用,如下所示:

- name: Install WebCompiler
        run: dotnet tool install Excubo.WebCompiler --global
        
- name: Run WebCompiler
        run: webcompiler //your_params_here

这个工具目前由作者支持,不像 madskristensen WebCompiler 并且支持最新的 sass 语法。

于 2021-02-06T21:15:51.270 回答