[Mono-dev] How to get the assembly version?

Kornél Pál kornelpal at gmail.com
Wed May 3 15:44:07 EDT 2006


Use System.Reflection.Assembly.GetExecutingAssembly ().GetName ().Version 
instead.

FileVersionInfo.GetVersionInfo uses the unmanaged (Win32) resource of the PE 
file.

Kornél

----- Original Message ----- 
From: "Fernando López" <ferrucosboy at gmail.com>
To: <Mono-devel-list at lists.ximian.com>
Sent: Wednesday, May 03, 2006 9:37 PM
Subject: [Mono-dev] How to get the assembly version?


Hi,

In my AssemblyInfo.cs, I have changed the version number to 1.0.0.0:

[assembly: AssemblyVersion("1.0.0.0")]

I'm trying to get the assembly version using the next code:

m_majorPart = System.Diagnostics.FileVersionInfo.GetVersionInfo(
System.Reflection.Assembly.GetExecutingAssembly
().Location).ProductMajorPart;
m_minorPart = System.Diagnostics.FileVersionInfo.GetVersionInfo(
System.Reflection.Assembly.GetExecutingAssembly
().Location).ProductMinorPart;
m_buildPart = System.Diagnostics.FileVersionInfo.GetVersionInfo(
System.Reflection.Assembly.GetExecutingAssembly
().Location).ProductBuildPart;

But I'm always getting the wrong value 0.0.0.0

Is this a bug? What do I have to do with it?

Thanks in advance.

Best regards from San Luis Potosi (Mexico).

Rafael Lopez.



--------------------------------------------------------------------------------


> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list