设置 VSTS 构建和发布以忽略项目的特定文件夹

Set VSTS build and release to ignore specific folder of projects

我正在云中的 VSTS 上构建 .net 核心 asp.net 应用程序。设置它时,它与我的 .net 框架的其他构建管道不同,因为您不需要 select 想要构建的解决方案,而是提供相对(通配符)路径到它可以找到项目文件的位置。

对我来说这最终是:Portal/API/**/*.csproj 问题是,在这个路径中还有我做的项目文件 NOT 想要作为这个特定管道的一部分构建。

我试图通过 ^Portal/API/Services/IdentityServer/**/*.csproj 从构建中删除特定路径,但没有效果。我真的不想指定所有我想直接构建的项目,因为我将不得不添加任何应该包含的新项目(基本上是除身份服务器项目之外的所有项目)。

那么,我可以排除包含通配符路径的项目吗?

更新。 根据此页面:

https://blogs.infosupport.com/tfs2015-build-tasks-the-wildcard-format-explained/

我应该可以写 Portal/API/**/*.csproj;-:Portal/API/Services/IdentityServer/**/*.csproj 但这不起作用,并且使用此配置构建存在错误说明:找不到项目。

所有排除表达式始终优先于包含表达式,因此如果文件同时匹配包含表达式和排除表达式,则不包含该文件。

对于新版本的任务,将-更改为!。关于minimatch patterns的官方文档也明确声明:

leading ! changes the meaning of an include pattern to exclude.

Exclude patterns

尝试使用 ! 而不是 - 并再次测试。此外,如果您不想构建特定项目,您也可以选择不下载源文件。这可以在

中完成

Cloak folders you don't need. By default the root folder of project is mapped in the workspace. This configuration results in the build agent downloading all the files in the version control folder of your project.

If this folder contains lots of data, your build could waste build system resources and slow down your build process by downloading large amounts of data that it does not require.

看看这个官方tutorial.

另一种解决方案是创建特定于您的程序包的解决方案配置,并将其用于管道任务。

创建解决方案配置 仅为需要的项目选中“构建”列。

查看此答案的“二”部分的更多详细信息:,尽管我建议阅读“一”部分。