How to execute .exe file from repo on azure pipeline
Asked Answered
K

2

7

I have an .exe file of my console app in a repository and I want to run it on a pipeline. I tried using a cmd task but it kept failing, saying it's not finding my .exe file.

Basically I tried the steps on here

when I followed the steps on the link above exactly, the log shows this

/home/vsts/work/_temp/7b7bec7c-25c2-4077-bdfb-052d01fcc054.sh: line 1: ConsoleApp.exe: command not found    
##[error]Bash exited with code '127'.

then I tried changing the script, from simply

ConsoleApp.exe

into

$(Build.SourcesDirectory)/ConsoleApp.exe

then it threw me another error

/home/vsts/work/_temp/da794edd-60c7-43c5-bd5d-eeff7fbefa46.sh: line 1: /home/vsts/work/1/s/ConsoleApp.exe: Permission denied
##[error]Bash exited with code '126'.

and now I'm starting to run out of ideas on why it's happening, so if anyone could help me out that would be great.

Keloid answered 25/2, 2021 at 12:37 Comment(1)
Would you be able to update your post with screenshots of your steps & agent configuration?Mango
G
3

Based on my test, I could reproduce this issue in Linux Agent.

enter image description here

To solve this issue, you need to check the following two fields to use the Windows-2019 Agent.

  • Pipeline -> Agent Specification

enter image description here

  • Agent job -> Agent Specification

enter image description here

By default, it will follow the settings in Agent Job scope.

Result:

enter image description here

Grieg answered 26/2, 2021 at 1:41 Comment(0)
C
0

If you want to reproduce steps from the article, you have to use:

  1. Command Line Script
  2. Windows-2019 vmImage

Finally, I setup a pipeline with a “Command Line Script” task to run the executable. Since it’s a Windows executable file, I set the Agent specification to “Windows-2019”.

In your case, you use a Linux vmImage.

Canvasback answered 25/2, 2021 at 13:14 Comment(2)
thanks for the answer. I'm already using Command Line Script. And I'm not sure why it's a Linux vmImage since I've already set the specification to Windows-2019, same as the articleKeloid
@Shadizz, add your pipeline configuration to the question because it reports da794edd-60c7-43c5-bd5d-eeff7fbefa46.sh. That command from a linux environment.Canvasback

© 2022 - 2024 — McMap. All rights reserved.