Display project version in ASP.NET MVC Core application (RC2)

前端 未结 5 609
生来不讨喜
生来不讨喜 2020-12-11 00:41

How do I display application version from the project.json? I am using gulp-bump to autoincrement version, but I can\'t show the recent version. Here is what I\

5条回答
  •  执念已碎
    2020-12-11 01:01

    Since Platform Abstractions were obly shipped with ASP.NET Core 1 and has been removed from ASP.NET Core 2 and up, if you're using version 2 or above, you must replace this row:

    Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion
    

    with this one:

    System.Reflection.Assembly.GetEntryAssembly().GetName().Version
    

    as specified in "Replacing API usage" section of the previous linked page.

提交回复
热议问题