PDA

Click to See Complete Forum and Search --> : Get a Version number for an ASP Project/Assembly??


tgoodmannz
May 5th, 2003, 08:52 PM
Hi,

Is it possible to get a version number for an ASP.NET project or Assembly?

I know that ASP.NET assigns my project a version number - it can be specified in AssemblyInfo.vb. I can also see it in the project.dll that gets created.

My question is how can I access it at runtime (to display/reference)

I thought I might be able to access it via:

System.Reflection.Assembly.Version

or similar, but I can't seem to get it.

Any ideas??

Thanks,
Tim

DevGrp
May 5th, 2003, 09:21 PM
Try this

Assembly asm;
asm = Assembly.GetExecutingAssembly();
Response.Write(asm.GetName().Name + " " + asm.GetName().Version.Major + "." + asm.GetName().Version.Minor + "." + asm.GetName().Version.Build);

tgoodmannz
May 6th, 2003, 12:51 AM
Thanks DevGrp,

I had to tweak it to run in VB .. for the record here is the code:


Dim asm As System.Reflection.Assembly
asm = System.Reflection.Assembly.GetExecutingAssembly()
mClientCL.UPAlert(asm.GetName().Name & " " & _
asm.GetName().Version.Major & "." & asm.GetName().Version.Minor & "." & _
asm.GetName().Version.Build & "." & asm.GetName().Version.Revision)



Tim