Print Version Number in ASP.NET MVC 4 app

前端 未结 7 2024
灰色年华
灰色年华 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:24

    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)
    

提交回复
热议问题