asp-append-version="true" this should append version to script. With .net core 1.1 it worked just fine. Recently upgraded to version 2.0 and it no longer works. Any ideas why?
asp-append-versionIf the web server is unable to obtain read access to the static file, no v parameter is added to the src attribute in the rendered markup. For a Tag Helper to generate a version for a static file outside wwwroot , see Serve files from multiple locations.
ASP.NET integrates seamlessly with popular JavaScript frameworks. Get started quickly with ASP.NET and React or Angular, using preconfigured templates.
The _ViewImports. cshtml file for an ASP.NET Core MVC app is typically placed in the Pages (or Views) folder. A _ViewImports. cshtml file can be placed within any folder, in which case it will only be applied to pages or views within that folder and its subfolders.
Go to Views -> Shared -> _Layout. cshtml file and add the render code. Make sure to register the custom javascript file after the jquery bundle since we are going to use jquery inside our js file. Otherwise we will get a jquery error and also register this before the script RenderSection.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With