TFS构建配置-Nuget Publisher

时间:2018-07-24 11:23:28

标签: tfs build devops

我们正在使用TFS和nexus软件包管理器。对于CI,我们有Nuget Publisher任务。

对于路径/模式,我写了:"^((?!SNAPSHOT).)*nupkg;-:**/packages/^((?!SNAPSHOT).)*nupkg;-:^((?!SNAPSHOT).)*nupkg"

我想说获取文件名中不包含SNAPSHOT的nupkg文件

  • 1-C:_work \ 2 \ s \ test-project.1.0.1-SNAPSHOT-umut.nupkg
  • 2-C:_work \ 2 \ s \ test-project.1.0.1.nupkg

我想取第二个文件。

但是当我开始构建时,出现错误:

Starting: NuGet Publisher 
******************************************************************************
==============================================================================
Task         : NuGet Publisher
Description  : Deprecated: use the “NuGet” task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this account/collection, and uses NuGet 4 by default.
Version      : 0.2.37
Author       : Lawrence Gripper
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=627417)
==============================================================================
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Error: No matching files were found with search pattern: C:\_work\2\s\**\*^((?!SNAPSHOT).)*nupkg;-:**\packages\**\*^((?!SNAPSHOT).)*nupkg;-:**\*^((?!SNAPSHOT).)*nupkg
Packages failed to publish
******************************************************************************
Finishing: NuGet Publisher 

1 个答案:

答案 0 :(得分:0)

Path/Pattern to nupkg参数不支持!通配符,它​​支持:

enter image description here

您需要使用powershell脚本来过滤和发布程序包。

this post中的

@TetraDev提供了一个Powershell脚本,可将NuGet程序包批量推送到VSTS提要。它将忽略任何.symbols.nuget文件:

set-location \\path\to\nugetpackages

$files=get-childitem | where {$_.Name -like "*.nupkg" -and $_.Name -notlike "*symbols*"}

foreach($file in $files) {
  .\NuGet.exe push -Source "MySource" -ApiKey key $file.name
}