2

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

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

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

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

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

TheHvidsten
  • 4,028
  • 3
  • 29
  • 62

1 Answers1

5

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
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • 1
    Putting them on multiple lines was the solution. Having them on the same line separated by a semicolon didn't for for `dotnet build`, though it does seem to work for `dotnet pack`. Thanks. – TheHvidsten Jun 16 '19 at 09:06
  • as far as I know the single line with `;` as a delimiter is old style syntax and is depreciated now – 4c74356b41 Jun 16 '19 at 09:29
  • `dotnet pack` only has one line to input project paths, whereas `dotnet build` has a multiline, so I think we're stuck with `;` there for the present. – TheHvidsten Jun 16 '19 at 16:06