Why Using DLL Version, are understand version like 1.0.0.0? Version Numbe help you to understand when last breakdown of software release. ASP.NET can read assembly version (dll file) in Web Project, but in Web Site ASP.NET can read app_code.dll assembly version.
STEP 1. ASSEMBLY VERSION
1. Create New Website from Visual Studio 2005. File > New > Web Site >
2. Write Assembly File
create new folder App_Code, create new item class, clear all text and fill with :
<assembly:System.Reflection.AssemblyVersionAttribute("versionNumber")>
To create an assembly-information file for your application
- Using a text editor, create a new assembly-information file. For Visual Basic applications, the suggested file name is AssemblyInfo.vb. For C# applications, the suggested file name is AssemblyInfo.cs.
- Add the following code to the assembly-information file.
<assembly:System.Reflection.AssemblyVersionAttribute("versionNumber")>
To specify the assembly-information file in your .aspx page
- Open your .aspx file in a text editor.
- Add the following attribute to the @ Page directive in the .aspx page.
CompilerOptions="path\AssemblyInfo.vb"
Replace the path parameter with the physical path to the assembly-information file on disk.
If the path to your assembly-information file contains spaces, you must enclose the path and file name in single quotation marks (‘).
CompilerOptions='"path with spaces\AssemblyInfo.vb"'
CompilerOptions='"path with spaces\AssemblyInfo.cs"'Replace the path with spaces parameter with the physical path to the assembly-information file on disk.
3. Compile your application for deployment. For more information, see How to: Precompile ASP.NET Web Site Projects for Deployment.
To specify the assembly-information file in your Web.config file
- Open your Web.config file in a text editor.
- Add the following code to your Web.config file.
<system.codedom> <compilers> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" compilerOptions="path\AssemblyInfo.vb" /> </compilers> </system.codedom>
- Compile your application for deployment. For more information, see How to: Precompile ASP.NET Web Site Projects for Deployment.
STEP 2. SHOW VERSION NUMBER
Assumtion in Page aspx have Label lbVersion
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ver As String = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() lbVersion.Text = "Ver. " & ver lbVersion.ForeColor = Drawing.Color.White End Sub
STEP 3. COMPILE THE WEB SITE
aspnet_compiler -p "C:\MyDevelopment\WebSite1" -v / C:\Staging
See Also :
http://odetocode.com/code/417.aspx
http://msdn.microsoft.com/en-us/library/ms229863(v=vs.80).aspx
C:\windows\microsoft.net\framework\v2.0.50727\ aspnet_compiler –v “Virtual Directory Name” –p “ <path source folder> ” “ <path folder destination> ” <error>
I visit everyday some sites and information sites to
read articles, but this weblog presents feature
based posts.
I quite like looking through a post that will make people think.
Also, thanks for allowing for me to comment!
Hey there Your entire web site starts up seriously slow to me, I am not
sure who’s issue is that although twitter and facebook starts really fast.
Well, I’d like to thank you very much for putting amazing content.
I’m sure this has already been totally beneficial to individual who seem to
visit here. This is without a doubt fantastic what you
actually have implemented here and wish to check out
content from you. I already have your site book-marked to check blogs you publish.