开发者

How to display an ASP.net MVC project version in page?

开发者 https://www.devze.com 2023-01-14 08:31 出处:网络
In WinForms, I\'d use Application.ProductVersion. I\'ve tried using System.Reflection.Assembly 开发者_Python百科in various ways but can never get the version of just the MVC project.Provided this cod

In WinForms, I'd use Application.ProductVersion.

I've tried using System.Reflection.Assembly 开发者_Python百科in various ways but can never get the version of just the MVC project.


Provided this code is explicitly in the MVC project (rather than in a helper assembly), you should be able to use System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3), which returns the major, minor, and revision numbers. Otherwise you might want to use something like typeof(HomeController).Assembly.GetName().Version.ToString(3).

0

精彩评论

暂无评论...
验证码 换一张
取 消