Is it important to record a hash value that is the official "Assembly hash value"? (I'm not sure that an "Assembly hash value" is even computed until you install it into the GAC.)
Recording the MD5 (or SHA1 or SHA256 etc) hash of the entire file (including the piece of the file that includes the "Assembly hash value" that -- when present -- is computed on what MS thought were the relevant parts of the .EXE / .DLL file) would work to get a "unique identifier" of the assembly. There's lots of sample code around for getting the hash of an existing file, using the System.Security.Cryptography.HashAlgorithm classes. At 02:54 AM 9/16/2003 -0400, Luca Minudel wrote >I've found APIs for the MVIS in the doc. >I will search the web for a wrapper. > >I've not found APIs for the Assembly hash value. >Are them there? > > >On Mon, 15 Sep 2003 17:49:34 -0600, Mike Woodring <[EMAIL PROTECTED]> wrote: > >>Keeping in mind that I've never used the API myself, I think you'll need to >>resort to the native metadata API support that's defined in <program >>files>\Microsoft Visual Studio .NET 2003\SDK\v1.1\Tool Developers >>Guide\docs\Metadata Unmanaged API.doc. Specifically, section/chapter 4. >> >>I don't know of a managed API equivalent for getting the same information - at >>least not in the SDK. It's possible that someone's written managed wrappers >>around the above APIs, but you'd have to look around on the web for those - >>they're not part of the SDK. >> >>-Mike >>http://www.bearcanyon.com >> >> >>> >>> -----Original Message----- >>> Sent: Monday, September 15, 2003 3:28 PM >>> >>> I like to get a unique identifier of a compiled assembly, >>> this identity will >>> be attached to results of tests logged in a file. >>> The assembly source code is available thus it can be changed and/or >>> recompiled by someone else. >>> Because one of the assemblies does not have a strong name I >>> cannot rely only >>> on it. >>> >>> How can I programmatically read the module version identifier >>> (MVID) of an >>> assembly module (the unique identifier given to the module at every >>> compilation)? >>> >>> How can I programmatically calculate the hash value of an >>> Assembly (the >>> assembly hash that CLR uses to make sure the assembly hasn't >>> been altered)? >>> >>> TIA (luKa) >>> J. Merrill / Analytical Software Corp =================================== This list is hosted by DevelopMentor� http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com
