Skip to content

tfx build tasks upload gives error no task.json in specified directory[49m At C:\Users\pkuijper\AppData\Roaming\npm\tfx.ps1:24 char:5 #459

@pkuijper

Description

@pkuijper

node version 22.3.0
npm version 10.8.1

PS C:\temp\SampleTask> tfx build tasks upload --task-path C:\temp\SampleTask
[37m[90mTFS Cross Platform Command Line Interface v0.17.0[37m[39m
[37m[90mCopyright Microsoft Corporation[37m[39m
node.exe : [41merror: Error: no task.json in specified directory[49m
At C:\Users\pkuijper\AppData\Roaming\npm\tfx.ps1:26 char:5
+     & "node$exe"  "$basedir/node_modules/tfx-cli/_build/tfx-cli.js" $ ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ([41merror: Err... directory[49m:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

File structure:

--- SampleTask
    |--- images
          |--- extension-icon.png
    |--- sampletask
          |--- ps_modules
                |--- ....
          |--- sample.ps1
          |--- task.json
    |--- vss-extension.json
    |--- test.sample-build-release-task-0.0.1.vsix

I tested the task.json content on https://jsonlint.com/, and it is valid.
if i open file "test.sample-build-release-task-0.0.1.vsix" as a zip it contains the task.json file.

i followed steps
https://learn.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
and the steps in
https://4bes.nl/2021/02/21/create-a-custom-azure-devops-powershell-task/

I login to our tfs server successfully with the command
"tfx login --auth-type pat --token **************************** --service-url https://mytfsserver/mycollections"
but uploading the task fails with command
"tfx build tasks upload --task-path C:\temp\SampleTask"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions