i have an API that i execute the .exe file (SelfHosted) in my server and to do so i must kill the process in the Task Manager and start it again.
I would like to do it via Azure Pipeline but I'm having troubles cause the process doesn't start but it seems everything is fine in Azure Pipeline.
Command executed:
I`ve tried:
1 - with this command the process kept running but the step in Azure Pipeline was endless
cd C:\PATH_TO_FOLDER
MY_FILE.exe
2 - with this command nothing happened
call start /b C:\PATH_TO_FOLDER\MY_FILE.exe
3 - with this command the process started but as soon as it starts it closes.
start cmd /c "C:\PATH_TO_FOLDER\MY_FILE.exe"
These are my steps. Btw i use IIS deploy cause i didn't find how to get the zip from my artifact and unzip it inside the path where my API is running:
Azure Pipeline Release Steps:
I can reproduce the same issue when using the commands shared by you. To keep the .exe
running after the Azure DevOps pipeline completes, you can create a scheduled task to start your .exe
. Here's how you can do it:
Create a scheduled task
Use a PowerShell script to create a scheduled task that starts your .exe
. The task can be configured to run under a specific user account and to start the application with the highest privileges. Run this script on your local machine.
$action = New-ScheduledTaskAction -Execute "C:\PATH_TO_FOLDER\MY_FILE.exe"
$trigger = New-ScheduledTaskTrigger -AtStartup
$principal = New-ScheduledTaskPrincipal -UserId "yourlocaluser" -LogonType ServiceAccount -RunLevel Highest
Register-ScheduledTask -Action $action -Trigger $trigger -Principal $principal -TaskName "StartApp" -Description "Starts the application at startup"