想要比较2个版本的项目中的2个C#类文件 [英] Want to compare 2 C# class files from 2 versions of project

查看:87
本文介绍了想要比较2个版本的项目中的2个C#类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想要比较来自2个版本项目的2个C#类文件,项目基础功能可以相同,但可以在任何项目中更改某些类(代码已更改)。现在我想知道像添加(添加了多少新方法/属性/类)和修改(修改了多少方法/属性/类)之间的差异列表。有没有最好的方法呢?



我尝试过:



尝试使用代码比较来比较文件,但无法获得差异,尝试使用Roslyn编译器,但仍然不能满足我的要求。

want to compare 2 C# class files from 2 versions of project, project base functionalities would be same but some of class can be changed (code changed) in any project. Now i want to to know the list of differences between like Added (how many new methods/properties/class are added) and Modified (how many methods/properties/class are modified). Is there any best way to do this?

What I have tried:

Tried to compare the files using code compare but could not able to get the differences, trying to use Roslyn compiler but still not matching anything to my requirement.

推荐答案

https://support.microsoft.com/en -ca / help / 159214 / how-to-use-the windiff-exe-utility [ ^ ]


你可以使用 ApiChange 实用程序(最初由Alois Kraus编写)用于比较例如dll: GitHub - arlm / apichange:Codeplex API变更存储库的分支 [ ^ ]

我们在构建器上使用它来检测API的重大更改:

You can use the ApiChange utility (originally written by Alois Kraus) for comparing e.g. dll's: GitHub - arlm/apichange: Fork of the codeplex API Change repository[^]
We use it on our builder to detect breaking changes to the API:
"ApiChange.exe" -diff -new "API.dll" -old "APIold.dll" >> APIchanges.txt
FIND "- public" APIchanges.txt
IF ERRORLEVEL 1 EXIT /B 0
ECHO  Errors: API or Interface is broken ! See APIchanges.txt >&2
Rem Use EXIT /B 0 for build to warn only.
Rem Use EXIT /B 1 for build to fail:
EXIT /B 1


这篇关于想要比较2个版本的项目中的2个C#类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆