且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查已编译的dll是否已更改?

更新时间:2022-10-31 21:29:22

由于DLL会产生不同的哈希值,因此很明显每次编译都会发生变化。也许某些内部原因是时间戳驱动的或随机的。

Since the DLLs produce different hashes, it's clear that something changes on each compile. Perhaps something internal is timestamp-driven or randomized.

从理论上讲,可以使用反射或ildasm以及对结果进行一些巧妙的比较,但这要比修改过程以使用递增版本字符串要困难得多。

Theoretically it's probably possible using reflection or ildasm and some smart comparison of the results, but that would be a lot harder than revising your process to use incrementing version strings.

我建议您自动化您的构建过程,并在每次构建时自动增加assemblyinfo.cs中的版本字符串。如果您使用的是源代码管理,则构建脚本可以将其签出,递增并重新签入。

I suggest that you automate your build process and automatically increment the version string in assemblyinfo.cs each build. If you are using source control, your build script could check it out, increment it, and check it back in.

希望这会有所帮助。