开发者

Tool for backwards compatibility for the C#/.NET API? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

开发者_高级运维

Closed 4 years ago.

Improve this question

I found this tool, http://sab39.netreach.com/Software/Japitools/JDK-Results/46/, which checks for backwards compatibility between different versions of APIs for Java using javadoc.

Is there an tool equivalent to this one for C#/.NET?

Here is an example of a comparison between JDK 1.5 and JDK 6 APIs using this tool: http://www.kaffe.org/~stuart/japi/htmlout/h-jdk15-jdk6


  • 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.


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.


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();
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜