规则C#类的向后兼容性/避免重大更改兼容性、规则、重大

2023-09-03 09:12:55 作者:珐嗨、伱卜慬鋨菂愛

我正在一个由在企业服务器环境中许多不同的应用所消耗的C#3.5组装。我想某些属性添加到现有的C#类(不是抽象的),并保持向后与现有客户的兼容性而无需重新编译。这是一个强烈的命名3.5组装。现有的客户端应用程序将不会被重新编译。相反,我们使用出版商​​策略组件重新定向现有客户端的更新版本。

I'm working on a C# 3.5 assembly that is consumed by many different applications in an enterprise server environment. I would like to add some properties to an existing C# class (not abstract) and maintain backwards compatibility with current clients without recompiling. It’s a strongly named 3.5 assembly. Existing client applications will not be recompiled. Instead we use publisher policy assemblies to re-direct existing clients to the updated version.

什么是规则维护该类型的类的向后兼容性?

What are the rules for maintaining this type of class backward compatibility?

我在找一些一套规则,我可以验证我的code的变化对。

I'm looking for some set of rules I can validate my code changes against.

在我目前的尝试更新类客户端扔找到的程序集清单定义不匹配的程序集引用异常。

After my current attempts at updating the class clients are throwing a "The located assembly's manifest definition does not match the assembly reference" exception.

推荐答案

最好的参考就是贾斯汀的回答是:的一个明确的指南,API-破变化.NET

The best reference is Justin's answer: A definite guide to API-breaking changes in .NET

@Justin - 如果你曾经发布此作为一个答案,我给你检查

@Justin - if you ever post this as an answer, I'll give you the check.