Reputation: 4866
I want to read the version info of a Strong Named .NET (built using v4.0) assembly using Powershell v2. I am using two different ways to do this, but the 2nd method always gives me the correct version information [although the 1st method was the obvious natural choice] :-
Method 1: [Reflection.AssemblyName]::GetAssemblyName("C:\ManagedAssembly.exe").Version.ToString()
gives the value as "50.0.0.0"
Method 2: [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\ManagedAssembly.exe").FileVersion
gives the version correctly as "50.0.0.93"
Any idea why such a behaviour ?
Upvotes: 2
Views: 1048
Reputation: 4866
My Mistake & Ignorance. The AssemblyVersionInfo.cs file contains two entries -
[assembly: AssemblyVersion("50.0.0.0")]
&
[assembly: AssemblyFileVersion("50.0.0.93")]
So, the above code is absolutely fine.
Upvotes: 1