You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在TFS 2018发布步骤中如何复制构建生成的.nupkg到Drop文件夹

How to Copy the Generated .nupkg to Drop Folder in TFS 2018 Release Pipeline

Got it, let's walk through exactly how to locate that StaticHelpers.1.0.0.nupkg file and copy it to your Drop folder for your release tasks. Here are two reliable methods you can use:

Method 1: Use TFS Built-in "Copy Files" Task

This is the simplest, no-code approach using TFS's native tasks:

  • Add a new task to your release pipeline stage, search for and select the Copy Files task.
  • Configure the task settings as follows:
    • Source Folder: Enter the directory where your nupkg lives: C:\agent_work\9\a\ (you can also use the variable $(System.ArtifactsDirectory) here for a more flexible, non-hardcoded path).
    • Target Folder: Specify your Drop folder path, e.g., $(System.DefaultWorkingDirectory)/Drop or your team's dedicated Drop directory.
    • Contents: Input StaticHelpers.1.0.0.nupkg to target the exact file. If you need to handle future version updates, use a wildcard like StaticHelpers.*.nupkg to match all versions of the package.
  • Save your pipeline and run the release—this task will automatically copy the file to your desired location.

Method 2: Use a PowerShell Script Task

If you prefer more control over the copy process, a PowerShell script works great:

  • Add a PowerShell task to your release pipeline stage.
  • In the Script field, paste this command (replace the destination path with your actual Drop folder):
# Copy the specific nupkg to Drop folder
Copy-Item -Path "C:\agent_work\9\a\StaticHelpers.1.0.0.nupkg" -Destination "C:\Your\Drop\Folder\Path" -Force
  • The -Force flag ensures any existing file with the same name gets overwritten, preventing release failures due to duplicate files.

Pro Tip for Flexibility

To avoid hardcoding the agent work directory number (like 9 in your path), use TFS's predefined variables. For example, the $(System.ArtifactsDirectory) variable points directly to the build output directory (C:\agent_work\9\a\ in your case). Your PowerShell command would look like this:

Copy-Item -Path "$(System.ArtifactsDirectory)\StaticHelpers.1.0.0.nupkg" -Destination "$(System.DefaultWorkingDirectory)\Drop" -Force

This way, even if the agent work directory changes, your script stays valid.

内容的提问来源于stack exchange,提问作者RandomHandle

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:07:58