JensB
JensB

Reputation: 6850

Set VSTS build and release to ignore specific folder of projects

I'm building a .net core asp.net application on VSTS in the cloud. When setting this up it differs from my other build pipeline for the .net framework in that you don't select a solution you want to build but instead provide relative (wildcard) paths to where it can find project files.

For me this ends up being: Portal/API/**/*.csproj The problem is that in this path there are also project files I do NOT want to build as a part of this particular pipeline.

I've tried to remove a certain path from the build by doing ^Portal/API/Services/IdentityServer/**/*.csproj but that had no effect. I would really prefer to not have to specify all the projects I want to build directly since I will then have to add any new project that should be included (which is basically all except identity server project).

So, can I exclude a project that the wildcard path included?

Update. According to this page:

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

I should be able to write Portal/API/**/*.csproj;-:Portal/API/Services/IdentityServer/**/*.csproj but this does not work and with this configuration the build exists with an error stating: no projects found.

Upvotes: 5

Views: 5432

Answers (2)

JotaBe
JotaBe

Reputation: 39015

An alternative solution is to create a solution configuration specific for your package, and use it for the pipeline task.

Create the solution configuration Check the "Build" column only for the needed projects.

See more details on part "Two" of this answer: https://stackoverflow.com/a/65633356/1216612, although I recommend reading the part "One".

Upvotes: 0

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51093

All exclusion expressions always take precedence over the inclusion expressions, so if a file matches both an inclusion and an exclusion expression, the file is not included.

For newly version of task, it's change - to !. The official doc about minimatch patterns also declared clearly:

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

Exclude patterns

Try to use ! instead of - and test again. Besides, if you do not want to build the a specific project, you could also chose not download source files. This could be done in

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.

Take a look at this official tutorial.

Upvotes: 4

Related Questions