8
votes

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?

2

2 Answers

14
votes

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

6
votes

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.