asp-append-version="true" not appending version to javascript file

https://github.com/MarkPieszak/aspnetcore-angular2-universal/issues/471

Basically you now need

@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"

And to make it easier, you can have a global _ViewImports.cshtml file under the Views folder, and just throw that line in there and it will apply the line to all View pages.


In MVC, we can do versioning by maintaining config value then used public class to append the version in JS and CSS reference.

CS:

  public static class StaticFileHelper
  {
    static string staticVersion;
    static StaticFileHelper()
    {
     staticVersion = System.Configuration.ConfigurationManager.AppSettings["JSVersioning"];
    }

    public static string StaticFile(this UrlHelper html, string filename)
    {
        var virtualPath =  ReleaseVirtualPath(filename);
        var root = html.RequestContext.HttpContext.Request.ApplicationPath;
        if (root.Length > 1) 
        {
            virtualPath = root + virtualPath;
        }
        return virtualPath;
    }
  }