Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read the version and other project metadata from project.json

In an ASP.NET Core ( ASP 5, ASP vNext):

How can I read the version and other meta data in the project.json in my Razor views?

My project.json file is something like this:

{ 
    "version" : "1.0.0-*",
    "authors" : ["author 1", "author 2"],
    "description" : "my project description"
    // ...
}
like image 323
A-Sharabiani Avatar asked Dec 01 '25 00:12

A-Sharabiani


1 Answers

You could use the options model. I have created a sample to read the version number out to the layout page next to the footer here and you can read about configuration here. Lastly, there is a great project for live.asp.net created by Damian Edwards of the ASP.NET team here. I hope this helps.

like image 81
Eric R Avatar answered Dec 02 '25 13:12

Eric R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!