如何比较同一DLL文件的2个版本。

问题描述:

大家好,有人可以告诉我是否可以比较版本2的dll文件是否相同但是较新的版本有更改的课程,如果有可能用旧版本替换旧的版本如果旧版本已经更新在您的代码中引用。如果有可能,有人可以给我一个提示从哪里开始。



我尝试过:



我试过在线搜索。我发现我的文章很少,但没有一篇文章特定于我的问题。

Hi guys could someone tell me if it is possible to compare the version 2 dll files that are the same but the newer version has changes ofcourse and if its possible to replace the old one with the newer one if the old one has been referenced in your code. If its possible can someone give me a hint where to start pls.

What I have tried:

ive tried searching online. I've found i few articles but none of them are specific to my problem.

您可以使用System.Reflection库来获取任何信息。部件。您正在寻找的属性是AssemblyName类的Version属性。



有关详细信息,请查看这个 MSDN文章。



有美好的一天。
You can make use of the System.Reflection library to get the information about any assembly. The property you're looking for is Version property of the AssemblyName class.

For more details check out this MSDN article.

Have a good day.


如果你所追求的是有关文件版本的信息;使用 FileVersionInfo [ ^ ]课程。它完全符合顾名思义。例如,如果你想要文件版本,你可以这样做:
If all you are after is information about the file version; use the FileVersionInfo[^] class. It does exactly what the name suggests. For instance, if you want the file version, you would do this:
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(filePath);
string productVersion = versionInfo.FileVersion;


请看一下>
我认为这符合您的要求。

使用哈希以编程方式比较两个DLL文件 [ ^ ]