3

How can one read the project.json version number at runtime? I.e. the "1.0.0-1234" in the config below:

{
  "title": "MyProject.Api",
  "webroot": "wwwroot",
  "version": "1.0.0-1234",
  "dependencies": {
     ...
  },
  ...
}
4

1 回答 1

8

您可以使用静态助手阅读它:

Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion 
于 2016-06-21T08:07:18.393 回答