How do I get the latest version of my solution recursively like its done in the solution explorer context menu of Visual Studio? I want to do this from the command line or via a macro. I'm trying to automate a part of my daily routine by using a set of batch files. I am sure a lot of developers would love to have something like this.
tf get
only gets contents of a folder recursively (not solution). It does not look at project dependencies and so on. That won't work.
Well... It looks like you have three options.
In your batch file, issue a tf get at each directory branch you want.
reorganize your solution so that all of the dependencies are under the same root path.
Use the visual way of right clicking on the loaded project and issuing the get command.
The only time it's actually solution aware is when the project is loaded in the IDE; or when it's loaded by the build servers.
I agree that Solution Explorer will "by design" omit all those objects, but only if you do not include them as Solution items, which I believe you should include in your solutions, so that a newbie can open the solution, do a Get Latest, and know they have all the dependencies needed for that solution, and not have to learn how to do it via a command line tool, or use Source Control Explorer if they don't want to.
Including all the non-code dependencies as solution items (we organize the solution folders using the same folder structure as their source control folders) reduces "voodoo" knowledge required to open and compile the solution for new developers on a project.
It would be good if you could link entire folder trees to a solution folder in the VS solution.
TFS has a .Net SDK that allows you to create your own custom programs that interact with a TFS Server. You could write a small program that performs the task you need:
If you have dependent projects under a different folder. Use this to loop through all of the sub directories to grab the latest for each project:
Start in the main directory
C:\Project\SupportingProjects
In my case the MainProject folder contains the solution file and the project file.
I found this easy and simple.
More on the FOR command: http://ss64.com/nt/for_d.html
One more possible solution is to use powershell. The following link is to a code project sample which shows how to get a solution from TFS and build it locally. Powershell is a much better solution than regular batch files.
http://www.codeproject.com/KB/install/ExtractAndBuild.aspx
Don't do this. VS is not nearly as smart as you think. (As evidenced by the mysterious & futile checkouts that everyone has experienced for 3+ product cycles, you & I included. This is not the mark of a reliable system!)
What you describe only works for project-to-project references. Running source control operations from Solution Explorer will "by design" omit:
Just say no to incomplete synchronization. Down that path, only headaches lie.
Run 'tf get' with no path scope from the command line, or rightclick -> Get from the root $/ node in Source Control Explorer.