我想在指定路径时确定“c#”中 dll 文件的文件版本。
假设 path = "\x\y\z.dll" 。
给定路径时如何查找 z.dll 的文件版本?
注意:我使用 Compact Framework 3.5 SP1
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");
// Print the file name and version number.
Console.WriteLine("File: " + myFileVersionInfo.FileDescription + '\n' +
"Version number: " + myFileVersionInfo.FileVersion);
From: http://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo.fileversion.aspx http://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo.fileversion.aspx
所以对你来说:
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(@"\x\y\z.dll");
如果 dll 是 .net 或 Win32,则此方法有效。仅当 dll 为 .net 时,反射方法才有效。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)