Using: Visual Basic .NET 2012

Problem: I am using the code below to get the version information from a system dll. It returns a version number and I check the file manually by going to C:\windows\system32, right clicking, going to properties, clicking on Details and the version number that VB.NET returned to me is not the one shown here. What is up?

    Dim dnsFile = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\dnsapi.dll"
    Dim myFileVersionInfo As FileVersionInfo
    If File.Exists(dnsFile) Then
        myFileVersionInfo = FileVersionInfo.GetVersionInfo(dnsFile)
        FileVersion = (myFileVersionInfo.FileVersion.Split(" ")(0)).ToString
    End If


Does anyone know why this is going on? I need to retrieve the version number shown to me in the Properties menu.

I still have no idea why this code (and the code given by Microsoft MSDN, which is similiar) is giving off wrong FileVersion and ProductVersion numbers.

Ok, found out how to get the proper file version through experimentation, but I don't understand why this works and the other method doesn't. Here is the new code to get the version number.

FileVersion = myFileVersionInfo.FileMajorPart.ToString & "." & myFileVersionInfo.FileMinorPart.ToString & "." & myFileVersionInfo.FileBuildPart.ToString & "." & myFileVersionInfo.FilePrivatePart.ToString

Versus the old one above (shown below too) that gives a different version number.

FileVersion = (myFileVersionInfo.FileVersion.Split(" ")(0)).ToString

Can anyone explain this?

I found that using version numbers for this particular project was a bad idea.. switched to MD5 hashes.. marking as solved now