I wanted to post replies to the following post...
Check-Out files from TFS 2010 with powershell
... but I couldn't as I don't have the Reputation yet.
Anyway, I need to check out AssemblyInfo* files recursively to adjust versioning information during our TFS Build process. I've been playing around with pre-build scripts from the Build Definition, but it doesn't seem to be having an effect (modified from the above post)...
#Checking out fileS
if ((Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue
if ((Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
#try to check out the code using command line tf.exe
&"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\TF.exe" checkout AssemblyInfo* /recursive | Out-Null
}
else{
#checkout the file using snapin
Add-TfsPendingChange -Edit AssemblyInfo*| Out-Null
}
}else{
#checkout the file using snapin
Add-TfsPendingChange -Edit AssemblyInfo*| Out-Null
}
As you can probably see, I'm no PowerShell guru, but I want to learn. I hacked away and combined some of the concepts in the above linked post, but it isn't working as a pre-build script. I just wanted to see that the files were checked out during the build (not checked in yet for testing purposes), but after the build completes, there are no files checked out in TFS. I'm not sure if something else is checking the files in from the TFS build itself, but it doesn't appear that the script is working.
What I would like to do is check out the AssemblyInfo files recursively, update the versions, compile the binaries, then possibly launch a post-build script to check the files in.
I found a versioning script here that appears to work and seems easy to implement. I was hoping to combine the concepts of checkout and versioning into one script.
Can anyone lead me in the right direction or illustrate what I am doing wrong? I guess I should state I'm using TFS/VS 2013.