Server: VSTS
Agent: Hosted VS 2017
Task: .NET Core (Preview)
Version: 2.* (preview)
Command: pack
NuGet.UseLegacyFindFiles = "true"
Unless I'm down the wrong path, it seems that the negative pattern is not being applied. Using the following pattern: **/*.csproj;-:**/*.Commands*.csproj, the negated projects are still being included.
~~~~
...
[debug]searchPatternPack=d:\a\1\s**.csproj;-:*.Commands.csproj
[debug]NuGet.UseLegacyFindFiles=true
[debug]pattern: d:\a\1\s**.csproj, isNegative: false
[debug]Matching glob pattern: d:\a\1\s**.csproj
[debug]Index of first wildcard: 9
...(file list)...
[debug]131 results
[debug]pattern: **.Commands.csproj, isNegative: true
[debug]Matching glob pattern: **.Commands.csproj
[debug]Index of first wildcard: 0
...(file list)...
[debug]131 results
[debug]Found 5 files
[debug]--File: d:\a\1\s\src\MyLib.Exports\MyLib.Exports.csproj
[debug]--File: d:\a\1\s\src\MyLib.Exports.Commands\MyLib.Exports.Commands.csproj
[debug]--File: d:\a\1\s\src\MyLib.Exports.Commands.Pdf\MyLib.Exports.Commands.Pdf.csproj
[debug]--File: d:\a\1\s\src\MyLib.Exports.OpenXml\MyLib.Exports.OpenXml.csproj
[debug]--File: d:\a\1\s\src\MyLib.Exports.Targets\MyLib.Exports.Targets.csproj
...
~~~~
The only difference I note here is that the second glob pattern does not have the path prefixed, which may mean the negate does not find any files and thus not excludes any.
_Note that this worked as expected in version 1 of the task, however with the non-legacy, multi-line glob:_
~~~
/.csproj
!/Commands*.csproj
~
I just ran into this as well. Not sure what determines NuGet.UseLegacyFindFiles
Task : .NET Core
Version : 2.131.0
tl.getVariable("NuGet.UseLegacyFindFiles") = True
nutil.resolveFilterSpec('**\*.csproj;-:**\*.Tests.csproj') - Good
nutil.resolveFilterSpec('**\*.csproj;!**\*.Tests.csproj') - Fail
tl.getVariable("NuGet.UseLegacyFindFiles") = False
t1.findMatch(undefined, ['**\\*.csproj','-:**\\*.Tests.csproj'], {},{}) - Fail
t1.findMatch(undefined, ['**\\*.csproj','!**\\*.Tests.csproj'], {},{}) - Good
This is still affecting me now. To get this working using the 2.* task, I have had to set the NuGet.UseLegacyFindFiles variable to true, and to manually inject the base path before each pattern section, e.g.
**\*.csproj;-:$(Build.SourcesDirectory)\**\*Commands*.csproj
The alternative is to set <IsPackable>false</IsPackable> in each csproj that NuGet should not package up.
I would much prefer if the dotnet pack task could be fixed to handle multi-line input or semicolon-delimited patterns correctly.
The bug is still there for now. I use .Net Framework projects and for me even <IsPackable>false</IsPackable> is not helped.
Hello! I'm a PM over on the Azure Artifacts team. I wanted to drop in here and address some of these issues with the news that we're currently reevaluating the types of tasks we offer in Azure Pipelines, and looking to focus more on lighter-weight tasks that cover authentication and setup. In lieu of the task redesign, we're going to forego making changes to the current tasks (with a few exceptions). We hope the new tasks we spin up in the next quarter or so are easier and more helpful, be on the lookout!
Most helpful comment
This is still affecting me now. To get this working using the 2.* task, I have had to set the NuGet.UseLegacyFindFiles variable to true, and to manually inject the base path before each pattern section, e.g.
**\*.csproj;-:$(Build.SourcesDirectory)\**\*Commands*.csprojThe alternative is to set
<IsPackable>false</IsPackable>in each csproj that NuGet should not package up.I would much prefer if the dotnet pack task could be fixed to handle multi-line input or semicolon-delimited patterns correctly.