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.
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?
Build, test, package, or publish a dotnet application, or run a custom dotnet command. Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
We use most is Nuget restore in TFS build definition. To promote a cleaner development environment and to reduce repository size, NuGet Package Restore installs all a project's dependencies as listed in either the project file or packages.config .
Navigate to your classic pipeline definition, and then select Edit. Select + to add a new task. Search for NuGet, and then select Add to add the task to your pipeline. Name your task and select Restore from the Command.
**\*.csproj;-:**\*test.csproj
should do it (no exclaimation point needed). If not, we may have a bug, and you should file it on GitHub.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With