I have an ASP.NET MVC 4 application. Currently, I am setting the version of the application in the project properties under the "Application" tab. From here, I click the "Assembly Information..." button. Once there, I have entered "1 0 0 *" in the "Assembly version" field.
My question is, how do I show this value on my web page? Currently, I am trying the following
@System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
Unfortunately, it's always printing "0.0.0.0". Realistically, I'd like to have it print 1.0.0.xyz. I would also like to print the date/time when the last build occurred. However, I have no idea how to do that.
What am I doing wrong?
ASP.NET Core MVC 3.1. 1 released on 14 January 2020 is the latest ASP.NET MVC version.
ASP.NET MVC 6 is a platform, which is supported in cross platform. It will run Windows, Linux and Mac. The steps are given below to create simple ASP.NET MVC 6 in Visual Studio 2017.
The ASP.NET MVC 5 Framework is the latest update to Microsoft's popular ASP.NET web platform. It provides an extensible, high-quality programming model that allows you to build dynamic, data-driven websites, focusing on a cleaner architecture and test-driven development.
To print the version number of the assembly in which was defined the controller that rendered this view:
@ViewContext.Controller.GetType().Assembly.GetName().Version
and for the assembly date:
@File.GetCreationTime(ViewContext.Controller.GetType().Assembly.Location)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With