The solution required that I use tf.exe, not an issue, but it is not in windows path by default. It is available if you use the Visual Studio Command Line, which is just a regular command line which runs a batch file. I thought it might be useful to have the ability to turn Powershell into a Visual Studio Command Line. I found a blog post, Replace Visual Studio Command Prompt with Powershell, that works, but I updated it to work with Visual Studio 2010 and more fully use the power of Powershell.
Set Visual Studio Command Prompt environment variables
1 2 3 4 5 6 7 | #Set Visual Studio Command Prompt environment variables pushd "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC" ; cmd /c "vcvarsall.bat&set" | ? { $_ -match "^(?<Name>[^=]+)=(?<Value>.+)$" } | % { Set-Item -Force -Path "env:\$($matches['Name'])" -Value $matches [ "Value" ]; } popd ; Write-Host "Visual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow; |
1 2 3 4 5 6 7 8 9 | param( [string] $SourceControlFilePath = $( Read-Host "Source Control File Path" ), [string] $Workspace = $( Read-Host "Workspace" ), [string] $Username = $( Read-Host "Username" ) ) & .\ set -vsvars .ps1; tf lock /lock:none $SourceControlFilePath /workspace: $Workspace `; $Username |
No comments:
Post a Comment