简体   繁体   English

如何在TFS和共享dll中处理公共库

[英]how to handle a common library in TFS & share dlls

I have 2 different applications set up in tfs source control. 我在tfs源代码控制中设置了2个不同的应用程序。 Both share a common library, also set up in source control. 两者共享一个公共库,也在源代码控制中设置。

The current process for changes to the common library is build it, copy across the dll's to a location for the other applications to pull in and work with. 更改公共库的当前过程是构建它,将dll复制到其他应用程序引入和使用的位置。 This is manual and does not work well, especially now that I am moving to TFS CI Builds. 这是手动的,不能很好地工作,特别是现在我正在转向TFS CI构建。

Layout like this in TFS: 在TFS中这样的布局:

-TFS
   - Web 1
      | Main
      | RB_1_0
   - Web 2
      | Main
      | RB_1_0
   - Shared
      | Main
      | RB_1_0
      | RB_2_0
      | RB_3_0

So I am looking to change this, automate it. 所以我希望改变它,自动化它。 But not sure how I can do such. 但不知道我怎么能这样做。 As you can see there are multiple branches etc. As its a common library I was considering to set up like I work with nuget packages, where changes are pushed to my web 1 and/or web 2. I am not sure how easy it is to set this up. 你可以看到有多个分支等。作为一个常见的库,我正在考虑设置像我使用nuget包,其中更改被推送到我的web 1和/或web 2.我不确定它是多么容易设置它。

Would be possible to review the above structure and give opinion on the best way to manage the distribution of the outputted dll's from common? 是否有可能审查上述结构并就管理输出dll的分布的最佳方式发表意见? In a CI environment? 在CI环境中? Is Nuget the best option? Nuget是最好的选择吗?

NuGet is what I use for this. NuGet就是我用来做的。

Modify the build process to create new packages for the common package 修改构建过程以为公共包创建新包

Add an activity to build a nuget package , and another that copies it to a network share you use as a NuGet repository. 添加一个活动来构建一个nuget包 ,另一个将它复制到您用作NuGet存储库的网络共享。 There's a few projects floating around like Tfs NuGetter that can be used instead of manually editing the build template. Tfs NuGetter这样的一些项目可以用来代替手动编辑构建模板。

If you don't want to modify your build template then you could use a tool like [tfs deployer] and write a custom deployment script that creates NuGet packages instead. 如果您不想修改构建模板,那么可以使用[tfs deployer]之类的工具编写自定义部署脚本来创建NuGet包。 Or write something that hooks into the build complete event. 或者写一些挂钩到构建完成事件的东西。

Enable Restore Packages on build for all solutions 在构建中为所有解决方案启用还原包

This means you don't need to store the packages in source control, or deal with packages not downloading when you get latest on the solution. 这意味着您无需将软件包存储在源代码管理中,也无需在最新解决方案时处理未下载的软件包。

When you want to update the version of the dependency open the solution and update it like any normal NuGet package. 当您想要更新依赖项的版本时,打开解决方案并像任何正常的NuGet包一样更新它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM