使用TFS的每个分支的Nuget存储库 [英] Nuget repository per branch with TFS
问题描述
我有一个具有以下分支设置的TFS环境
I have a TFS environment with the following branching setup
- Dev-开发人员的主要工作分支
- 主要-稳定,可发布的分支
- 修补程序-用于修复不属于正常发布周期的生产代码
我们正在设置使用Nuget,我想配置一些东西,例如Dev分支中的代码从'Dev'nuget存储库中提取软件包,从'Main'仓库中获取main,等等.
We're setting ourselves up to use Nuget, and I want to configure things such that code in the Dev branch pulls packages from the 'Dev' nuget repository, main from the 'Main' one, etc.
现在,我已经解决了所有问题,直到我在分支的根目录下有了一个文件,告诉nuget.exe使用哪个存储库.
Now, I've figured things out to the point where I have a single file sitting the root of my branch that tells nuget.exe which repository to use.
我现在试图弄清楚在每个分支中如何使这些文件的内容不同.我可以分别将它们检入每个分支,但这会带来从Dev-> Main和Main-> HotFix合并的问题.
I'm now trying to figure out how to have the contents of those files different in each of those branches. I can check them in to each branch separately, but that will introduce problems with merging from Dev->Main and Main->HotFix.
所以,我想我想做的就是以某种方式将这个特定的配置文件排除在Dev-> Main等的合并之外.有什么办法吗?
So, I think what I want to do is somehow exclude this particular config file from being part of merges from Dev->Main, etc. Any way to do that?
或者,是否有其他方法可以完成我想要对Nuget进行的操作,就可以将其指向不同分支的不同nuget存储库?
Or, alternatively, is there some other way to accomplish what I want to do with Nuget, in terms of pointing it to different nuget repositories for different branches?
推荐答案
您将不得不做一些魔术...
You'll have to do some trickery...
- 每个分支都有不同的提要.设置多个供稿的一种简单方法是www.myget.org
- 在要注册这种行为的解决方案中启用NuGet软件包还原
- 在解决方案的.nuget \ nuget.config文件中,添加以下内容:
<configuration>
<packageSources>
<add key="Branch X packages" value="http://www.myget.org/F/corpxyzbranchxyz" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="Branch X packages" value="http://www.myget.org/F/corpxyzbranchxyz" />
</activePackageSource>
</configuration>
这样做意味着每个分支必须拥有一个不同的nuget.config文件,并且在合并/分支时应格外小心.
This does mean that you'll have to have a different nuget.config file per branch and that you should be careful when merging/branching.
这篇关于使用TFS的每个分支的Nuget存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!