构建所有 csproj 文件,除了测试项目 [英] Build all csproj files, except Test projects

查看:26
本文介绍了构建所有 csproj 文件,除了测试项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 DevOps 中,您可以创建一个 dotnet build 任务,其中项目路径"可以设置为 **/*.csproj 以构建所有项目.

In DevOps you can create a dotnet build task where "Path to project(s)" can be set to **/*.csproj to build all the projects.

这很好用,但它(显然)也构建了我的 *.Test.csproj 项目.

This works just fine, but it (obviously) also builds my *.Test.csproj projects.

我发现一些帖子提到了排除模式,所以我尝试做与那些帖子相同的操作并尝试以下组合:

I found some posts mentioning exclude patterns, so I tried doing the same as in those posts and tried the following combinations:

**/*.csproj;-**/*.Test.csproj
**/*.csproj;!**/*.Test.csproj

**/*.csproj;-:**/*.Test.csproj
**/*.csproj;!:**/*.Test.csproj

对于所有尝试,我在 DevOps 日志中收到以下错误:

For all attempts I get the following error in the DevOps log:

未找到与指定模式匹配的项目文件.

Project file(s) matching the specified pattern were not found.

那么,我如何创建一个 dotnet build 任务来构建我的所有项目除了*.Test.csproj 项目?>

So, how can I create a dotnet build task to build all my projects except the *.Test.csproj projects?

推荐答案

以下是我用来运行所有测试的方法,除了其中一些:

here's what I've been using to run all tests except for some of them:

  Test/**/*.csproj
  !**/*.Billing.Test.csproj
  !**/*.Queues.Test.csproj
  !**/*.WidgetDataProvider.Test.csproj

出于同样的原因,您需要使用:

so by the same token you need to use:

  **/*.csproj
  !**/*.Test.csproj

据我所知,顺序很重要,所以这行不通:

as far as I understand, order matter, so this will not work:

  !**/*.Test.csproj
  **/*.csproj

这篇关于构建所有 csproj 文件,除了测试项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆