views:

107

answers:

4

Hey,

I have a need to provide a 32-bit CRC (Cyclic Redundancy Check) of all assemblies, which is stored (for release control purposes), and may then be compared against the assemblies present on a system at a later date (in order to check that the release hasn't been corrupted in some way).

I have no problem calculating the CRC of the assemblies themselves, my question is this:

Do .NET assemblies ever change? I.e. Does the actual binary content of the assembly ever change (for any reason) after it is installed on the target system? If it does, then the CRC would change also.

Note, I am referring only to assemblies that are packaged with my software, not the standard System assemblies, those are not checked.

Cheers

+4  A: 

If you don't update the assemblies (overwrite them), they will never change.

Philippe Leybaert
Or assemblies may be re-signed
Igor Korkhov
A: 

i recall reading somewhere that the .net optimiser searches for and goes through any assemblies to 'optimise' them? heard it did this after an install - never looked into it myself though - id imagine they probably dont change but im not sure if its something you can really guarantee

try it and see! good luck

fusi
You are talking about Ngen.exe. It creates another file.
Hans Passant
+6  A: 

You are re-inventing a wheel, strong naming already does this. Tampering an assembly so that it has the right CRC32 is pretty simple. Breaking a strong name is not, it is cryptographically secure.

Hans Passant
Yes, .NET already has a mechanism built-in to handle your requirement which you should definitely prefer over a custom method.
0xA3
Thanks for the alternate recommendation, and you are right, it is a preferred approach, however, this is company policy dictated by more senior engineers than myself. Not a lot I can do really.
Kazar
A: 

They should only change while installation or update, unless a programmer has included some nasty hack into his program. But if you are in doubt, why don't you just revoke the user rights for writing or modifying the according files?

Doc Brown