9

我有 project.json 文件,其版本指定为

{
    "version": "1.0.0-*"
}

我怎样才能在代码中阅读它?

4

2 回答 2

9

AssemblyInformationalVersionAttribute从程序集中获取

于 2015-09-28T15:36:31.600 回答
1
  • 在您的 project.json 中更改“版本”:“1.1.xxxx”
  • 那么在你的剃刀视图中,也许是_Layout页脚?@using System.Reflection @{ ViewData["Version"] = typeof(Startup).GetTypeInfo().Assembly.GetCustomAttribute().InformationalVersion; }
  • 然后 ViewData["版本"]
于 2016-08-17T03:00:46.777 回答