is it possible to get a file from TFS into a local unmapped folder?
Looking at the docs for tf get I think the answer is no. St开发者_如何学运维ill, I could be wrong. I'd like to have a file that's mapped to C:\Projects\MyProject\SQL\myScript.sql. I'd then like to run a batch file that gets several files (including that one) from the repository, puts them into a local temp folder, runs them, then deletes them.
It's the first part that's the issue: I think that TFS won't let you get files into a folder without remapping the source folder to point to that folder first.
So I suppose I need to remap the remote folder to point to a new local folder (C:\Temp\Scripts for instance) then get the files, then map the folder back to where it was. Seems like an extra step that helps nothing.
Have a look at tf view to see if that does what you need. Otherwise, the usual pattern for doing stuff similar to this is to create a new workspace using the tf workspace command, map the folder, do a get then destroy the workspace.
Even better for you would probably to use the .NET API VersionControlServer.DownloadFile() - especially if you are doing his from a powershell script rather than a simple batch file.
精彩评论