I’ve been trying for days to get a PowerShell script together that will CheckOut AssemblyInfo files recursively then modify the File and Version numbers. This would be part of a prebuild script in a TFS (2013) Build Definition. The version information is set based on the Build Number Format attribute or setting in the Definition.
I found this script that works to version the output files as desired…
Although this gets me part of the way to where I want to be, it does not retain the information in the AssemblyInfo files as they are not checked out. If I got that working, I was simply planning on checking the files back in via a post-build script.
I’m not using the Power Tools as I was just going to call tf.exe directly since I don’t have a lot of heavy lifting to do via script in TFS.
`&“C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Ide\TF.exe” checkout $/CITest/AssemblyInfo.* /recursive | Out-Null`
That would work from the PowerShell command line, but not from the script. So, I changed the TFS path to the local path and it appeared that the file would be checked out…
`&“C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Ide\TF.exe” checkout C:\src\CITest\AssemblyInfo.cs /recursive | Out-Null`
When I try to jam this somewhere in the above linked script, I get errors. If anyone can guide me to a script that will checkout the AssemblyInfo files recursively and modify them with version, that would be AWESOME!! If I can get that far, all I will need is a post build script to check them in.
I’m not even sure if this is doable in TFS as I’m not sure what happens to checked out files once the actual TFS build completes (before the post build script is run). Maybe I have to do all the work in the pre-build script.
Anyway, ANY help appreciated!
Thanks in advance