I would like to know if we have a way to run an exe in Azure devops and passing required parameters for that. I am using below task "PowerShell" and it gives me the error
**
"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a_temp\5f91c58a-381d-4c41-9969-3038116adefa.ps1'" & : The term 'MyProject.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At D:\a_temp\5f91c58a-381d-4c41-9969-3038116adefa.ps1:5 char:3"
**
Below is the task created in YAML.
- task: PowerShell@2
displayName: Execute .exe file with parameters
inputs:
targetType: 'inline'
script: |
[String]$myrev = $Env:BUILD_BUILDNUMBER
$args = @($myrev)
& 'MyProject.exe' $args
Thanks in advance for the responses.
Little more info, tried to access the path where the build is created. Before accessing the path to run the exe, we are building the project and is kept at the default Azure Build Directory. Still same error but with full path.
- task: MSBuild@1
inputs:
solution: '**/*.csproj'
clean: true
- task: PowerShell@2
displayName: Execute .exe file with parameters
inputs:
targetType: 'inline'
script: |
[String]$myrev = $Env:BUILD_BUILDNUMBER
$args = @($myrev)
& '$(Build.SourcesDirectory)\MyProject\bin\Release\MyProject.exe' $args