检查已编译的dll是否已更改? [英] Check to see if a compiled dll has changed?

查看:82
本文介绍了检查已编译的dll是否已更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试找出一种方法来查看用户PC上的dll是否与部署服务器不同。我们无法使用时间戳记,因为构建脚本每次都会构建所有内容(这是我们希望保留的方式)。我们也不想使用版本号,因为我们肯定会看到很多人忘记了这个版本。我们的某些dll一直都在更改(每周至少两次)。我试图用每个文件的MD5哈希值创建一个XML文件,但是显然这是行不通的,因为即使我们没有任何改动,每次编译时哈希值都会改变。还有其他方法吗?

We are trying to figure out a way to see if a dll on a user pc is different from the deployment server. We can't use a timestamp because our build script builds everything everytime (and this is the way we want to keep it). We also prefer not to use version # because we can definitely see people forgetting this a lot. Some of our dlls change all the time (at least a couple times a week). I tried to create an XML File with the MD5 hash of every file but apparently this won't work because the hash changes every time we compile it even if there was no changes. Is there any other way?

推荐答案

由于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.

希望这会有所帮助。

这篇关于检查已编译的dll是否已更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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