防止 Appveyor 构建 VS 解决方案的项目

Prevent a VS solution's project from being built by Appveyor

我的 GitHub repository 中的 .sln 文件有两个项目 -- class 库项目和测试项目。我只希望 AppVeyor 构建库项目,因为测试项目需要安装 Microsoft Access 数据库引擎。

我正在使用 appveyor.yaml

我该怎么做?

您可以从自动 msbuild 模式切换到 script 模式,方法是在您的 yaml 配置文件中添加 build_script 部分。这可能看起来像这样...


build_script:
  - msbuild StringAsSql/StringAsSql.csproj /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

这与 AppVeyor 会在您的解决方案文件上自动 运行 的命令相同。

此处有许多可能的选项。

要禁用测试,请在 appveyor.yml 中设置以下内容:

tests: off

或者创建一个特殊的构建配置(通过Visual Studio Configuration Manager...),比如ReleaseCI,并在[=中指定配置13=]:

configuration: ReleaseCI

另一种选择是创建多个解决方案文件; UI 切换解决方案比 UI 更简单(Solution Explorer -> Switch views...)切换构建配置。要指定应将哪个 .sln 文件传递​​给 MSBuild:

build:
    project: MySolution.sln