Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
411 views
in Technique[技术] by (71.8m points)

versioning - ASP.NET - show application build date/info at the bottom of the screen

I have a asp.net web application which has a number of versions deployed on different customer servers inside their networks. One practice that we have is to have clients email screenshots when they have issues.

In the old asp.net 1.1 days, we could grab details of the build DLL, using reflection, and show info about the build date and numbering on the screen in a subtle location.

With .NET 2.0 and higher, the build model changed, and this mechanism no longer works. I have heard of different build systems out there, but I'm really looking for the simplest way, on the 3.5 framework, to do what this functionality did on framework 1.1.

  1. Every time a build is performed, update the build date/time, and somehow update the build number
  2. Be able to see the build timestamp and number, to display on the screen
  3. be as simple to implement as possible
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I chose to just use the date of the executing assembly. The way I publish the files, this works fine.

lblVersion.Text = String.Format("Version: {0}<br>Dated: {1}",
    System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
    System.IO.File.GetLastWriteTime(System.Reflection.Assembly.GetExecutingAssembly().Location).ToShortDateString());

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...