如何从MsBuild找到tf.exe的路径

发布于 2024-11-28 10:01:00 字数 190 浏览 2 评论 0原文

我有一个 MsBuild 文件,它使用 tf.exe 向 TFS 输出一些内容。不幸的是,tf.exe 文件已安装到开发人员 PC 和构建服务器上的不同位置。

我真的可以用一种方法来检测 tf.exe 文件在我的脚本中的位置,就像您可以执行 $(MSBuildExtensionsPath32) 等一样。这可能吗?

一如既往的感谢:)

I have an MsBuild file which shells out to TFS using tf.exe for a few things. Unfortunately the tf.exe file has been installed to different locations on the developer PCs and the build server.

I could really do with a way of detecting where the tf.exe file is located within my script in the same way you can do $(MSBuildExtensionsPath32) etc. Is this possible?

Thanks as always :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暗恋未遂 2024-12-05 10:01:00

环境变量 VS100COMNTOOLS 是否指向 Visual Studio 的正确路径?
例如
VS100COMNTOOLS=C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\

所以你所需要的只是 $(VS100COMNTOOLS)..\IDE

<Target Name="Build">
   <Exec Command=""$(VS100COMNTOOLS)..\IDE\tf.exe""/>
</Target>

或者你想要清理它的任何东西。

环境变量会根据 Visual Studio 的版本而变化:

  • %VS110COMNTOOLS% - Visual Studio 2012
  • %VS120COMNTOOLS% - Visual Studio 2013
  • %VS140COMNTOOLS% - 视觉工作室 2015

Does the environment variable VS100COMNTOOLS point to the correct path for visual studio?
E.g.
VS100COMNTOOLS=C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\

So then all you need is $(VS100COMNTOOLS)..\IDE

<Target Name="Build">
   <Exec Command=""$(VS100COMNTOOLS)..\IDE\tf.exe""/>
</Target>

or however you want to tidy it up.

The environment variable changes depending on the version of Visual Studio:

  • %VS110COMNTOOLS% - Visual Studio 2012
  • %VS120COMNTOOLS% - Visual Studio 2013
  • %VS140COMNTOOLS% - Visual Studio 2015
長街聽風 2024-12-05 10:01:00

似乎他们在 Visual Studio 2017 中再次更改了位置。
它不在我机器上的上述任何位置。

我在以下位置找到了 TF.exe:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer

(有些用户可能会在Professional 文件夹而不是 Enterprise 文件夹:C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe

显然 VS 2017 中不再默认设置环境变量

Seems they changed location again in Visual Studio 2017.
It was not in any of the above locations on my machine.

I found TF.exe instead at:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer

(Some users may find in the Professional folder instead of Enterprise folder: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe)

Apparently the environment variable is no longer set by default in VS 2017.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文