Monday, June 25, 2012

Get Assembly Info for ASP.Net

To get the assembly version for an ASP.Net site, simply use the following code:


Assembly web = Assembly.GetExecutingAssembly();
AssemblyName webName = web.GetName();
string myVersion = webName.Version.ToString();


Then, to set the assembly version, simply go to Properties/AssemblyInfo.cs, as usual.


[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]



No comments: