使用 TFS 2010 进行依赖管理 [英] Dependency management with TFS 2010

查看:15
本文介绍了使用 TFS 2010 进行依赖管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 TFS 2010 管理依赖项的最佳方法是什么?

What is the best way to manage dependencies with TFS 2010 ?

我想知道是否有像 Maven 或 NuGet 这样的系统可以在 TFS 2010 中轻松管理 .dll 的依赖项(外部的或由我们的团队创建).然而我们面临的问题是,我们希望能够修改我们的 dll 的代码并实时测试它们是否工作(无需发布新包).

I would like to know if there is a system such as Maven or NuGet which allows to easily manage dependencies of .dll (externals or created by our team) inside TFS 2010. However we face the problem that we want to be able to modify the code of our dll and test in real time if they work (without publishing a new package).

推荐答案

作为预构建步骤调用 NuGet 实际上非常容易.您可以使用 NuGet 引用覆盖项目的 *.*proj 文件中的 BeforeBuild 目标.

It's actually pretty easy to invoke NuGet as a pre-build step. You can override the BeforeBuild target in your *.*proj file for the project with NuGet references.

<Target Name="BeforeBuild">
  <Exec Command="&quot;$(SolutionDir)Tools
uget&quot; install &quot;$(ProjectDir)packages.config&quot; -o &quot;$(SolutionDir)Packages&quot;" Condition="'$(BuildingInsideVisualStudio)'==''" />
</Target>

正如上面的代码片段所暗示的,您需要下载 NuGet 命令行实用程序,将其放在解决方案文件夹下的文件夹中,并将其签入版本控制.请注意,您下载的可执行文件实际上是一个引导程序,您需要运行一次以下载真正的 可执行文件.

As implied by the snippet above, you'll want to download the NuGet command line utility, place it in a folder beneath your solution folder, and check it into version control. Note that the executable you download is actually a bootstrapper that you'll want to run once to download the real executable.

接下来,您需要检入项目目录中的packages.config 文件,而不是解决方案目录下的packages 文件夹.请注意,我已经在上面的预构建步骤中检查了 $(BuildingInsideVisualStudio) not 是否被设置.这将导致在使用 TFS 构建服务(或从命令行)构建时在构建时下载和安装包.它不会影响您在 Visual Studio 中的 NuGet 体验.

Next you'll want to check in the packages.config file from your project directory, but not the packages folder beneath your solution directory. Note that I've included a check for $(BuildingInsideVisualStudio) to not be set in the pre-build step above. This will cause the packages to be downloaded and installed at build-time when building with the TFS build service (or from the command line). It won't affect your NuGet experience inside Visual Studio.

您可以搜索有关使用 TFS 自动创建 NuGet 包的文章 - 很多人已经在博客上发表了相关文章.两者的结合构成了一个非常强大的依赖管理解决方案.现在我们只需要一个内置在 TFS 中的 NuGet 提要;)

You can search for articles on automating the creation of NuGet packages with TFS - quite a few people have blogged about it. The combination of the two makes for a very capable dependency management solution. Now we just need a NuGet feed built into TFS ;).

这篇关于使用 TFS 2010 进行依赖管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆