Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

asp-append-version TagHelper does not work in combination with abp-src TagHelper #8597


User avatar
0
aldfrance created

Hello,

I'm currently working with AspNetZero using the Asp.Net Core MVC + jQuery project type (version 8.1.0).

I have some troubles working with the script tag in my razor views when both abp-src and asp-append-version tag helpers are used together. The version number is not generated (in the query string), so when I change the content of my javascript file, the new content is not downloaded by the browser (the browser uses the cached version). If I only use the asp-append-version everything is ok. But as soon as I add the abp-src tag helper, the version number disappears.

To clarify my purpose, if I use this line in my razor view, everything is ok: < script src="/view-resources/Areas/Admin/Views/_Bundles/user-list.min.js" asp-append-version="true" >< /script > generates this in my HTML: < script src="/view-resources/Areas/Admin/Views/_Bundles/user-list.min.js?v=H17KbnXsI4JZ9ooTcjHIIXKQQH3dvEKrPygKpJT3TQw" >< /script >

As soon as I add the abp-src tag helper, the version disappears, for instance: < script abp-src="/view-resources/Areas/Admin/Views/_Bundles/user-list.js" asp-append-version="true" >< /script > generates this in my HTML: < script abp-src="/view-resources/Areas/Admin/Views/_Bundles/user-list.js" src="/view-resources/Areas/Admin/Views/_Bundles/user-list.min.js" >< /script > (in DEV mode, so the abp-src tag helper remains)

This behavior is very strange as it appears natively in your solution in many razor pages and seems to not work properly


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    see https://github.com/aspnetzero/aspnet-zero-core/pull/2870

    Make sure you run the npm run create-bundles command.