Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 914
Roman Avatar asked Nov 09 '17 14:11

Roman


People also ask

What is ASP append version?

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.

Can you use ASP net with JavaScript?

ASP.NET integrates seamlessly with popular JavaScript frameworks. Get started quickly with ASP.NET and React or Angular, using preconfigured templates.

What is _ViewImports Cshtml?

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.

How can add JavaScript file in ASP NET MVC?

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.


1 Answers

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.

like image 134
goamn Avatar answered Sep 17 '22 13:09

goamn