vb.net - Get file version -
i can file version of exe(its own version) in vb6 using app.major
,app.minor
, app.revision
etc. how can same in vb.net. tried using following 3 methods.
text1.text = my.application.info.version.major & "." & my.application.info.version.minor & "." & my.application.info.version.build & "." & my.application.info.version.revision text2.text = me.gettype.assembly.getname.version.tostring() text3.text = my.application.info.version.tostring()
in 3 cases returning assembly version(i checked in bin folder exe created in xp machine.in windows 8 didnt see option assembly version when see file properties)
by default both assembly , file versions same.but when changed manually in project properties->applicationassembly information->file version
came know code returning assembly version. how can file version? assembly , file vesrion?
so in .net programs, there 2 versions, not 1 (of i'm aware). assembly version grabbing , easier retrieve in .net. ".net's version" when assemblies have different versions, that's 1 uses.
then there "file version" or in 1 place see microsoft has called "assembly file version" make confusion worse. 1 needs see whether name includes "file" or not. "file" version assembly associated file system, when @ version in windows explorer, you'll get.
why microsoft split 2 different things , didn't tie them together, not understand. maybe can enlighten me further.
i figured out code grab fileversion. found question because looking how retrieve (in vb, not c#). think c# makes things easier, including accessing assembly. here's vb code retrieve file version of program:
dim filename$ = system.reflection.assembly.getexecutingassembly().location dim filename2$ = application.executablepath ' grabs filename too, ' #2 ends ".exe" while 1st ends ".exe" in windows 7. ' either filename or filename2 works me. dim fvi fileversioninfo = fileversioninfo.getversioninfo(filename) ' fvi has properties fileversion information. dim fvasstring$ = fvi.fileversion ' other useful properties exist too.
wow, lots of code should simple in vb6. maybe app.version.tostring or something. wow. way go, microsoft! @ least 1 isn't difficult of stunts tho, playing own music string.
Comments
Post a Comment