Edward Wilson
Edward Wilson

Reputation: 456

VSTS NuGet pack exclude test projects

I am using VSTS vNext build system to build a C# solution. Below you can see the settings for the NuGet Packager. The path to nuspec files is set to reference the .csproj files.

enter image description here

However this includes all .csproj files; I need to exclude test projects. Ignoring 'Core.Test.csproj' but still packaging 'Core.csproj'.

I have tried '*.csproj;-:!*test.csproj' and other combinations but have had no luck figuring this out! Does anyone know how the pattern matching works for vNext build?

Upvotes: 9

Views: 4979

Answers (2)

Chrono
Chrono

Reputation: 1473

The latest version (2.x) of the NuGet task in VSTS and TFS 2018 uses a different pattern for excluding packages. Now you use ! instead of -:.

So **\*.csproj;-:**\*.Test.csproj changes to **\*.csproj;!**\*.Test.csproj.

Full pattern matching documentation can be found here.

Upvotes: 11

Matt Cooper
Matt Cooper

Reputation: 937

**\*.csproj;-:**\*test.csproj should do it (no exclaimation point needed). If not, we may have a bug, and you should file it on GitHub.

Upvotes: 14

Related Questions