【问题标题】:TFS | VSTS - Custom Build Task execution cannot find VstsTaskSdk.psd1TFS | VSTS - 自定义构建任务执行找不到 VstsTaskSdk.psd1
【发布时间】:2017-05-08 15:12:06
【问题描述】:

我的团队正在处理使用vsts-task-lib 的 TFS/VSTS 自定义构建任务。

我们按照this github page 上的说明将其包含在您的自定义任务中。

我在本地安装了 vsts-task-lib 用于交互式测试,并且执行正常。我可以将扩展上传并安装到我的 VSTS 帐户/项目中。

但是,当我将所有内容排好并在 VSTS 上执行发布时,我得到以下信息:

2016-12-22T21:41:27.4700501Z ##[section]Starting: ApprendaDeploy 

2016-12-22T21:41:27.5110766Z ==============================================================================

2016-12-22T21:41:27.5120761Z Task         : Deploy App on Apprenda

2016-12-22T21:41:27.5120761Z Description  : This task deploys your application onto ACP

2016-12-22T21:41:27.5120761Z Version      : 0.1.0

2016-12-22T21:41:27.5120761Z Author       : Apprenda

2016-12-22T21:41:27.5120761Z Help         : Replace with markdown to show in help

2016-12-22T21:41:27.5120761Z ==============================================================================

2016-12-22T21:41:27.8483971Z ##[error]File not found: 'C:\a\_tasks\ApprendaDeploy_fb765e50-c211-11e6-9471-0d5c99017b97\0.1.0\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1'

2016-12-22T21:41:27.8553964Z ##[section]Finishing: ApprendaDeploy 

我正在使用 vsts-task-lib v0.8.0,我的任务根文件目录如下所示:

|-- apprendaDeploy <task root>
  |----- ps_modules
     |----- VstsTaskSDK
        |----- 0.8.0
            |------ <corresponding sdk files, including VstsTaskSdk.psd1>
  |----- common.ps1
  |----- deploy.ps1
  |----- icon.png
  |----- task.json

有什么想法吗?

【问题讨论】:

  • 看起来您缺少路径中的版本?应该是...\VstsTaskSDK\0.8.0\VstsTaskSdk.psd1。或者尝试将 SDK 文件移出 0.8.0 文件夹,使其位于 VstsTaskSDK 文件夹中。
  • 你能在 OneDrive 上分享那个扩展文件吗?
  • 完全删除该版本。应该是ps_modules/vststasksdk/vststasksdk.psd1

标签: powershell tfs azure-devops


【解决方案1】:

您需要将 SDK 文件移动到 ...\VstsTaskSdk\*,而不是将它们放在特定于版本的文件夹中。我遇到了同样的问题并以这种方式解决了。

【讨论】:

  • 您知道是否可以安装到模块路径并自动加载还是必须复制到每个任务中?我正在努力寻找关于新图书馆的好文档
  • 你是怎么配置的?
  • 您需要将其复制到每个任务中。
  • 这也是this tutorial的一部分
  • 我希望这对我有用...我没有完成任何任务。我按照这些说明到了一个 T
猜你喜欢
  • 1970-01-01
  • 2017-04-15
  • 1970-01-01
  • 2019-01-10
  • 2017-06-04
  • 1970-01-01
  • 2020-02-19
  • 2017-10-03
  • 2019-03-28
相关资源
最近更新 更多