You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more
Any experts in the house?
I have a build connected to Azure DevOps - so whenever something is checked-in it grabs the latest code and does a full build.
I was wondering if it's possible to modify a file after the latest code is downloaded but before the build actually happens?
Thanks in advance!
Cheers,
GQ
Yes. The first build step, or any step before the step(s) to build the code, could be a cmd or powershell script, or some other process that modifies the file.
But.... Do you want the file to be modified and checked back into the repo it came from (assuming it's part of the repo), or just modified? Both are possible but if the file comes from the same repo as the build is monitoring, and you check the file in, it may/will fire another build into the queue on every build.
Screenshot of your build steps could be useful...
Oops, sorry
Thanks, there is only one build step which seems to update the sources (ie grab the code) and then build. So just not sure where this new step might go.
It's a visual studio solution build that points to a sln file.
So I need to somehow separate this one step into two so I can add this new step in between?
And to add, I don't want this modified file checking back in.
Sounds about right for a simple build process - grab code, build code.
Have a look at this video, it should help.
https://m.youtube.com/watch?v=m4BGB_JBjgQ
You will have to write the CMD or powershell script to edit the file too
There's a lot of info on jetbrains web site.
Ah okay, thanks for that. So the build step isn't actually getting the code (that's already happened).
I will add a step before the build then. I just need to work out how I locate the file and then change its contents - I'll have a dig around the JetBrains website.
Cheers!
If you have a look at the build log it will tell you the location of the build directory, and there's teamcity variable you can use in the build step to reference the folder - %TeamCity.Build.tmpDir% or something like that, if the file is within the build directory.