C#/.NET API 向后兼容的工具?

发布于 2024-08-24 04:42:56 字数 1539 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怎言笑 2024-08-31 04:42:56
  • ApiChange 确实采用一组不同的“旧”程序集和一组“新”程序集对于可能破坏 Api 的更改:

    <块引用>

    ApiChange -diff -旧 HelloWorldV1.dll -新 HelloWorldV2.dll

  • LibCheck 允许您比较程序集的两个版本并确定差异。该工具将差异报告为“已删除”和“已添加”API 的组合:

    <块引用>

    LibCheck -store HelloWorld.dll 1.0 -full C:\HelloWorldV1\
    LibCheck -store HelloWorld.dll 2.0 -full C:\HelloWorldV2\
    LibCheck - 比较 1.0 2.0

另请参阅“使用 LibCheck”“突出显示程序集修订版之间的公共 API 差异”“程序集之间的 Api 差异” 文章。

  • ApiChange does take a set of "old" assemblies and a set of "new" assemblies which are diffed for potentially breaking Api changes:

    ApiChange -diff -old HelloWorldV1.dll -new HelloWorldV2.dll

  • LibCheck allows you to compare two versions of an assembly and determine the differences. The tool reports the differences as a combination of "removed" and "added" APIs:

    LibCheck -store HelloWorld.dll 1.0 -full C:\HelloWorldV1\
    LibCheck -store HelloWorld.dll 2.0 -full C:\HelloWorldV2\
    LibCheck -compare 1.0 2.0

See also "Working with LibCheck", "Highlight Public API Differences Between Assembly Revisions" and "Api Diff Between Assemblies" articles.

东走西顾 2024-08-31 04:42:56

我还没有尝试过您链接到的 Java 工具,但是 NDepend 有一些强大的工具用于比较两组二进制文件并突出显示任何差异。

I haven't tried the Java tool you linked to, but NDepend has some powerful tools for comparing two sets of binaries and highlighting any differences.

别理我 2024-08-31 04:42:56

我还没有测试过,但是这个库
https://github.com/tunnelvisionlabs/dotnet-compatibility
似乎提供了你想要的。

https://raw.githubusercontent.com/tunnelvisionlabs/dotnet-compatibility /master/CompatibilityCheckExample/Program.cs

IPackageRepository sourceRepository = PackageRepositoryFactory.Default.CreateRepository("https://www.nuget.org/api/v2/");
PackageManager packageManager = new PackageManager(sourceRepository, temporaryDirectory);
packageManager.PackageInstalled += HandlePackageInstalled;
packageManager.InstallPackage("Microsoft.Bcl.Immutable", SemanticVersion.Parse("1.0.34"));
packageManager.InstallPackage("System.Collections.Immutable", SemanticVersion.Parse("1.1.33-beta"));

using (PEReader referenceAssembly = new PEReader(File.OpenRead(Path.Combine(temporaryDirectory, "Microsoft.Bcl.Immutable.1.0.34", "lib", "portable-net45+win8+wp8+wpa81", "System.Collections.Immutable.dll"))))
{
    using (PEReader newAssembly = new PEReader(File.OpenRead(Path.Combine(temporaryDirectory, "System.Collections.Immutable.1.1.33-beta", "lib", "portable-net45+win8+wp8+wpa81", "System.Collections.Immutable.dll"))))
    {
        Analyzer analyzer = new Analyzer(referenceAssembly, newAssembly, null);
        analyzer.Run();
    }
}

I haven't tested it, but this library
https://github.com/tunnelvisionlabs/dotnet-compatibility
seems to provide what you'd want.

https://raw.githubusercontent.com/tunnelvisionlabs/dotnet-compatibility/master/CompatibilityCheckExample/Program.cs

IPackageRepository sourceRepository = PackageRepositoryFactory.Default.CreateRepository("https://www.nuget.org/api/v2/");
PackageManager packageManager = new PackageManager(sourceRepository, temporaryDirectory);
packageManager.PackageInstalled += HandlePackageInstalled;
packageManager.InstallPackage("Microsoft.Bcl.Immutable", SemanticVersion.Parse("1.0.34"));
packageManager.InstallPackage("System.Collections.Immutable", SemanticVersion.Parse("1.1.33-beta"));

using (PEReader referenceAssembly = new PEReader(File.OpenRead(Path.Combine(temporaryDirectory, "Microsoft.Bcl.Immutable.1.0.34", "lib", "portable-net45+win8+wp8+wpa81", "System.Collections.Immutable.dll"))))
{
    using (PEReader newAssembly = new PEReader(File.OpenRead(Path.Combine(temporaryDirectory, "System.Collections.Immutable.1.1.33-beta", "lib", "portable-net45+win8+wp8+wpa81", "System.Collections.Immutable.dll"))))
    {
        Analyzer analyzer = new Analyzer(referenceAssembly, newAssembly, null);
        analyzer.Run();
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文