9

I've the project.json file with a version specified as

{
    "version": "1.0.0-*"
}

How can I read it in code?

rkhb
  • 14,159
  • 7
  • 32
  • 60
tmm360
  • 404
  • 4
  • 13

2 Answers2

9

Get the AssemblyInformationalVersionAttribute from the assembly

Victor Hurdugaci
  • 28,177
  • 5
  • 87
  • 103
1
  • in your project.json change the "version": "1.1.xxxx"
  • then in your razor view, maybe _Layout footer? @using System.Reflection @{ ViewData["Version"] = typeof(Startup).GetTypeInfo().Assembly.GetCustomAttribute().InformationalVersion; }
  • then ViewData["Version"]
lant
  • 41
  • 2