Asp.Net 5: How to load assembly version from project.json file?
Asked Answered
S

2

9

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

{
    "version": "1.0.0-*"
}

How can I read it in code?

Stableboy answered 28/9, 2015 at 15:31 Comment(0)
C
9

Get the AssemblyInformationalVersionAttribute from the assembly

Campobello answered 28/9, 2015 at 15:36 Comment(2)
Can you explain more please?Lara
Here's an example that shows you how to get the version github.com/aspnet/dnx/blob/…Campobello
S
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"]
Strephon answered 17/8, 2016 at 3:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.