Print Version Number in ASP.NET MVC 4 app

前端 未结 7 2029
灰色年华
灰色年华 2020-12-23 19:15

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 \

7条回答
  •  长情又很酷
    2020-12-23 19:17

    In case you are publishing your application on a production server, I would recommend using something like

    @String.Format(
        "{0:ffffdd, MMMM d, yyyy HH:mm:ss}", 
        File.GetLastWriteTime(ViewContext.Controller.GetType().Assembly.Location))
    

    for retrieving the date.

    This will print the actual publish date since File.GetCreationTime() will give you the date the actual assembly dll was first copied on the server.

提交回复
热议问题