coding4fun
coding4fun

Reputation: 8209

Check to see if a compiled dll has changed?

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?

Upvotes: 4

Views: 2430

Answers (3)

Nico Schuele
Nico Schuele

Reputation: 107

I was recently asked to do a similar task and I used the Reflector Diff AddIn.

Upvotes: 1

mac
mac

Reputation: 5647

You probably have an incremental build number that gets included in some version string of your dll. Have you tried doing a diff on your dlls? If that is the case you may be able to "mask" the version string on the fly for the calculation of you md5 hash.

Upvotes: 0

Elroy Flynn
Elroy Flynn

Reputation: 3218

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

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.

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.

Hope this helps.

Upvotes: 0

Related Questions