本文介绍了想要比较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.

推荐答案


"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#类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 10:59