2011-12-21 2 views
2

C#System.Diagnostics.FileVersionInfo을 사용하여 파일 목록에서 버전 정보를 추출하려고합니다. 이렇게하기위한 나의 목적은 고유 한 파일 경로와 버전 조합을 추적하는 것입니다. 파일이 바뀌면 정확히 바뀐 내용에 따라 다양한 일이 일어나길 바래요.FileVersionInfo가 Explorer의 Details 탭과 일치하지 않습니다.

FileVersionProductVersion 속성을 모두 FileVersionInfo으로 사용했습니다. 두 버전 모두 탐색기에보고 된 것과 다른 버전 번호를보고합니다. ProductMajorPart 일치하지 않는 몇 가지 이유를 들어 ProductVersion 속성을 explorer.exe를

Explorer Details tab reports: "6.1.7601.17567" (for both File and Product) 
FVI.ProductVersion reports: "6.1.7600.16385" 
FVI.FileVersion reports: "6.1.7600.16385 (win7_rtm.090713-1255)" 

답변

3

를 사용

/MinorPart/BuildPart/PrivatePart ... 당신이 할 수있는 실제 버전을 얻으려면 :

var fvi = FileVersionInfo.GetVersionInfo(path); 
var productVersion = new Version(
          fvi.ProductMajorPart, 
          fvi.ProductMinorPart, 
          fvi.ProductBuildPart, 
          fvi.ProductPrivatePart); 
var fileVersion = new Version(
          fvi.FileMajorPart, 
          fvi.FileMinorPart, 
          fvi.FileBuildPart, 
          fvi.FilePrivatePart); 
+0

Worked Perfectly. 감사. Microsoft의 무한한 지혜. – Vitus

관련 문제