Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the Build Version

Status
Not open for further replies.

dace

Programmer
Jul 21, 2001
263
0
0
US
Hi all -
I just have a quick question about build versions.

With other .NET languages, you can get the build version from
System.Windows.Forms.Form.Application.ProductVersion.

Is there an equivalent for ASP.NET? I tried looking for a property in System.Web.UI.Page, but I haven't been having any luck so far.

Thanks!
 
I am not sure if this is 100% of what you are looking for but I always check the properties of the dll that gets compiled and put into the bin directory of my application. Click the "Version" tab and you will see what version number the assembly got.

HTH

Eva
 
Thanks for your reply evaleah.

I know that's possible, but I need a way to get the version in-code.
 
Replace myApp.exe with the name of your application...

FileInfo fileInfo = new FileInfo("myApp.exe");
if (fileInfo.Exists)
{
sCurDir = fileInfo.DirectoryName;
strFile.Insert(0,sCurDir + "\\" + "myApp.exe");
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(strFile.ToString());
lblVersion.Text = "File Version: " + myFileVersionInfo.FileVersion.ToString();
}
else
lblVersion.Text = "File Version not determined";

}

 
Not entirely sure (haven't used it myself), but how 'bout System.Reflection.AssemblyVersionAttribute?

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top