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

守給你的承諾、 提交于 2019-12-11 03:56:12

问题


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.


回答1:


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...)




回答2:


For newer searchers, I found this build variable page, and this is TFS 2015 specific, but it has:

BUILD_SOURCESDIRECTORY

The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s.



来源:https://stackoverflow.com/questions/13693102/is-there-any-macro-to-get-the-root-directory-of-the-tfs-sourcecontrol-in-visual

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!