Tedious Workspace Mappings
It is a privilege to be working on SmartCare here in Lusaka and a pleasure to be doing so from a local network. But you know me, never a dull moment: I’m using Visual Studio 2010 Team Suite Beta 1 to help me explore the solution, refactor and debug. Real solutions are great for bug hunting in a beta product, but the itch I had to scratch today was the tedium of recreating workspaces.
I tend to use a workspace with two Maps and two Cloaks for this project:
But if you’re working in a virtual machine or with a beta product, you may find yourself frequently throwing away your workspaces to ensure you have a clean start.
Do that often enough and you’ll find yourself looking for a command line tool or script to help set up your workspaces. Easily done with the “TF” command line utility that ships with Team Explorer:
tf workspace /new /noprompt /s:serverName workspaceName /login:serverName\anton,password
tf workfold /unmap . /login:serverName\anton,password
tf workfold /map "$/SmartCare2007/3rd Party Libraries" "3rd Party Libraries" /s:serverName /workspace:workspaceName /login:serverName\anton,password
tf workfold /map "$/SmartCare2007/Source/Main/SmartCare" "Source\Main\SmartCare" /s:serverName /workspace:workspaceName /login:serverName\anton,password
tf workfold /cloak "$/SmartCare2007/Source/Main/SmartCare/DatabaseBackup" /s:serverName /workspace:workspaceName /login:serverName\anton,password
tf workfold /cloak "$/SmartCare2007/Source/Main/SmartCare/Installers" /s:serverName /workspace:workspaceName /login:serverName\anton,password
tf get /login:serverName\anton,password
Remember to launch your command line using the Visual Studio shortcut – that way all the PATH environment variable is set for you. Full script attached below.
Notice above I used “unmap” immediately after creating the workspace. I couldn’t count on having a template workspace available, so I just removed the default mapping of the current folder immediately after creating the workspace, then follow that with the explicit map and cloak commands.