.netvisual-studio-2010tfspost-build-eventvisual-studio-macros

Is there any macro to get the root directory of the TFS Sourcecontrol in Visual Studio?


Is there any built-in macro to obtain the TFS Sourcecontrol Root directory in Visual Studio?

For example just like $(ProjectDir), I would use $(TFSSourceControlRoot) or something like that?

The reason I need this is to in order to use this path in the xcopy command which I will need as a part of a post build action. Instead of writing something like C:\Source\Scripts, I want to write something like $(TFSSourceControlRootDir)\Source\Scripts.


Solution

  • If you mean the root of the folder structure on the server, then you can refer to it as simply $/. However, if you mean the local folder that this is mapped to, there's not a macro for that. The reason is that you can map any number of folders in the server hierarchy to local disk folders, so there's not necessarily a single root - and there's not necessarily a folder that maps to $/ at all.

    (That said, if you can explain why you need it, there might be alternative suggestions...)