Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS2015 Build fails on all Command Line Commands with 'file not found'

In Team Foundation Server 2015 Build (on-premise), I'm having issues running simple command line commands. All Command Line tasks simply fail with the following error: "File not found: ".

Take for example the following build definition:

enter image description here

This is executed using an on-premise Build Agent and will fail with the following exception in the logs:

BUILD FAILED
2016-01-20T12:04:47.5127709Z ##[warning]Filename doesn't indicate a full path to a executable file.
2016-01-20T12:04:47.5127709Z Executing the following commandline. (workingFolder = D:\_work\2\s)
2016-01-20T12:04:47.5127709Z date 
2016-01-20T12:04:47.5127709Z Error message highlight pattern: 
2016-01-20T12:04:47.5127709Z Warning message highlight pattern:      
2016-01-20T12:04:47.5439748Z ##[error]File not found: date

Of course this is a simplified example where I simply want to output the current date using the date /t command. But the same problem occurs with all general command line commands which I've tried, such as dir, time, path etc. The MSDN does not provide any troubleshooting info on it, other than that the tool executed must reside in the PATH variable.

The issue is not specific to one build definition or repo; it can be reproduced on others as well.

The builds run as the built-in svc_tfsbuild account.

I'm perhaps thinking this is either a simple setting, or - wildly guessing - an issue related to rights, but cannot find any documentation where to look or what to check. Any help would be appreciated.

like image 700
Juliën Avatar asked Dec 11 '22 18:12

Juliën


1 Answers

It appears this is a known issue on MS Connect as well.

In short a MSFT mentions the following:

Commands that are built-in to command prompt don't work. Anything resolvable based on your PATH/PATHEXT will work.

In the comment from 27 Oct, 2015 it is stated that this will be fixed in the next sprint. The mentioned workaround for now is simply executing cmd.exe first and provide the rest as arguments.

Using the example from the original question this would lead to:

Tool: cmd.exe
Arguments: /c "date /t"

And I can indeed confirm this works.

like image 176
Juliën Avatar answered Apr 29 '23 02:04

Juliën