I'm trying to create a diagnostic log for my application that will display the latest version number of an assembly installed in the GAC. For example, there are two versions of the same assembly in the GAC: foo.dll version 1.0.0.0 and foo.dll version 2.0.0.0. I need a function like the following:
GetLatestGacVersion("foo.dll"); // returns "2.0.0.0"
Anyone know the best way to do this?
Thanks!
Easiest is:
which will automatically give you the latest-version assembly from the GAC.
Please note that the Method is deprecated for good reasons. Asking for an unspecific version from the GAC is going to possibly cause lots of trouble.
Without really knowing what you want to do it's hard to give further advice, but in general if you are looking for a specific version you should rather probe for it instead of just loading "something".