Cannot run executable in TeamCity

1.1k views Asked by At

I'm attempting to run a .Net console application (in TeamCity) I wrote which will change a variables value in a batch script located in the check out directory.

Unfortunately I'm receiving an error while running the step. Process exited with code -2146232576

Currently I'm using a Command Line build step with the following settings:
Runner Type: Command Line
Step Name: Update setVars.bat
Execute Step: If all previous steps finished successfully
Run: Executable with parameters
Command Executable: E:\Test\Release\ReplaceText.exe
Command Parameters:

"%system.teamcity.build.checkoutDir%\DeploymentScripts\setVars.bat"
"(?m)(SET RunDate\s?=\s?[A-Za-z]{4}-[A-Za-z]{5}-(\d+[.]?)+)"
"SET RunDate=Build-%build.number%" "%system.teamcity.build.checkoutDir%\DeploymentScripts\setVars.bat"

There are 4 parameters listed.
1) - Where to locate the batch script
2) - The Regex pattern
3) - The replacement text
4) - The output directory

I'm unable to use the built in file replacer as it reverts back its changes once the build is successful.

I've run the console application on its own and it works just fine. So I'm unsure as to why team city is unable to run the application. The error code tells me nothing.

Any help would be great appreciated.

1

There are 1 answers

0
WBuck On BEST ANSWER

OK, I found the issue. When I created the Console application I used VS 2017 with a .Net version of 4.6.2. That version of .Net is not installed on the CI server.

I changed the Console application to target .Net 4.5. This fixed the issue.