Retrieving file version causes the file to remain open
Posted on 2007-10-08
string filename = @"\\UNC file name";
Assembly asm = Assembly.LoadFile(filename);
int tMajor = asm.GetName().Version.Major;
int tMinor = asm.GetName().Version.Minor;
int tBuild = asm.GetName().Version.Build;
int tRevision = asm.GetName().Version.Revision;
the above method works fine for retrieving the build information; however, it keeps the file open.
How can i close the file ( there is no dispose or close function on asm ) after I retrieve the version information? Is there a better way or retrieving the version info?
Thanks for the help.