简体   繁体   English

如果仅参考版本更改,我是否应该更新程序集版本?

[英]Should I update version of assembly if only reference version changed?

I have AssemblyA with version 1.0.0 and AssemblyB with Version 1.0.0.我有版本为 1.0.0 的 AssemblyA 和版本为 1.0.0 的 AssemblyB。 AssemblyB references AssemblyA and I create NuGet packages of both assemblies. AssemblyB 引用 AssemblyA,我创建了两个程序集的 NuGet 个包。

Now, I've made a bug fix in AssemblyA and it gets version 1.0.1.现在,我在 AssemblyA 中修复了一个错误,它获得了 1.0.1 版。 Should I now update AssemblyB also to 1.0.1 cause of the changed reference or should I only update the version if I have changes in code?我现在是否应该将 AssemblyB 也更新为 1.0.1,因为引用已更改,或者我是否应该仅在代码发生更改时才更新版本?

The NuGet packages are only used in a local feed (company wide). NuGet 包仅用于本地提要(公司范围)。

What are the pro and cons of both solutions?两种解决方案的优缺点是什么? My pro is, that I do not reference an old, buggy package and when I use both assemblies in ApplicationC, I have only to reference and update AssemblyB.我的优点是,我没有引用旧的、有问题的 package,当我在 ApplicationC 中使用这两个程序集时,我只需要引用和更新 AssemblyB。 But it feels cringe, to update a version number without any changes in code.但是,在不更改代码的情况下更新版本号让人感到畏缩。

Given MyCoolPackage 1.0.0 having a dependency on MyPoorDependency 1.0.0, and you having bugfixed MyPoorDependency to 1.0.1, then yes, an updated dependency for a package means a new version of that package.鉴于 MyCoolPackage 1.0.0 依赖于 MyPoorDependency 1.0.0,并且您已将 MyPoorDependency 错误修复为 1.0.1,那么是的,package 的更新依赖性意味着 package 的新版本。

If you only publish the dependency update, MyCoolPackage 1.0.0's metadata will still point to MyPoorDependency 1.0.0.如果您只发布依赖项更新,MyCoolPackage 1.0.0 的元数据仍将指向 MyPoorDependency 1.0.0。 Users of your package won't know there's an update for its dependencies. package 的用户不会知道它的依赖项有更新。 They can have their package manager set up to only install the lowest common denominator of dependencies or even pinned the version to MyPoorDependency 1.0.0.他们可以将其 package 管理器设置为仅安装依赖项的最低公分母,甚至将版本固定为 MyPoorDependency 1.0.0。 Because after all, that's what your MyCoolPackage 1.0.0 says it'll work with.因为毕竟,这就是您的 MyCoolPackage 1.0.0 所说的它可以使用的内容。

For this the package manager looks at all your users' project dependencies, will see that it requires MyCoolPackage 1.0.0, which has a dependency on MyPoorDependency 1.0.0, and it won't update .为此,package 经理会查看所有用户的项目依赖项,会发现它需要 MyCoolPackage 1.0.0,它依赖于 MyPoorDependency 1.0.0,并且不会更新

So yes, update MyCoolPackage to require MyPoorDependency 1.0.1 and release an new version, probably also 1.0.1.所以是的,更新 MyCoolPackage 以要求 MyPoorDependency 1.0.1 并发布一个新版本,可能也是 1.0.1。

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

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