/// <summary>Returns a <see cref="T:System.Diagnostics.FileVersionInfo" /> representing the version information associated with the specified file.</summary> /// <returns>A <see cref="T:System.Diagnostics.FileVersionInfo" /> containing information about the file. If the file did not contain version information, the <see cref="T:System.Diagnostics.FileVersionInfo" /> contains only the name of the file requested.</returns> /// <param name="fileName">The fully qualified path and name of the file to retrieve the version information for. </param> /// <exception cref="T:System.IO.FileNotFoundException">The file specified cannot be found. </exception> /// <filterpriority>1</filterpriority> public static FileVersionInfo GetVersionInfo(string fileName) { string fullPath = Path.GetFullPath(fileName); if (!File.Exists(fullPath)) { throw new FileNotFoundException(fileName); } FileVersionInfo fileVersionInfo = new FileVersionInfo(); fileVersionInfo.GetVersionInfo_internal(fileName); return(fileVersionInfo); }
public static FileVersionInfo GetVersionInfo(string fileName) { #if !NET_2_1 if (SecurityManager.SecurityEnabled) { new FileIOPermission(FileIOPermissionAccess.Read, fileName).Demand(); } #endif string absolute = Path.GetFullPath(fileName); if (!File.Exists(absolute)) { throw new FileNotFoundException(fileName); } FileVersionInfo fvi = new FileVersionInfo(); fvi.GetVersionInfo_internal(fileName); return(fvi); }
public static FileVersionInfo GetVersionInfo (string fileName) { #if FEATURE_MONO_CAS if (SecurityManager.SecurityEnabled) { new FileIOPermission (FileIOPermissionAccess.Read, fileName).Demand (); } #endif string absolute = Path.GetFullPath (fileName); if (!File.Exists (absolute)) throw new FileNotFoundException (fileName); FileVersionInfo fvi = new FileVersionInfo (); fvi.GetVersionInfo_internal (fileName); return fvi; }