Tag Helpers not working in published site
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
When running in the debugger, the “site.js” script tag successfully gets a hash appended to its query string (as expected), and the files matching the src-include have script tags generated for them. However, after publishing neither of these features work. It’s unclear if any other tag helpers are working either. Tested running both in IIS and just running the EXE file generated by the publish.
<environment include="Development">
<script src="~/Identity/lib/jquery/dist/jquery.js"></script>
<script src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
</environment>
<environment exclude="Development">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"
asp-fallback-src="~/Identity/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"
asp-fallback-src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
crossorigin="anonymous"
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj">
</script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
</environment>
<script type="module" asp-src-include="/js/header/polyfills.*.js"></script>
<script type="module" asp-src-include="/js/header/main.*.js"></script>
Expected Behavior
Tag helpers, specifically src-include, work in a published app the same as in development.
Steps To Reproduce
- Create ASP Core Web API project with ASP Identity
- Override some Identity pages, including the main _Layout.cshtml. Leaving the existing markup is fine.
- Make sure the new Layout page is used by adding:
@{
Layout = "/Pages/Shared/_Layout.cshtml";
}
To the _ViewStart.cshtml of the Identity area being overriden 4. (Optional) Add some script tags with asp-src-include
Exceptions (if any)
No response
.NET Version
6.0.203
Anything else?
.NET 6, VS 2022.
Also asked at https://stackoverflow.com/questions/73862284/asp-net-core-tag-helpers-dont-appear-to-be-working-in-published-exe#73862284
Issue Analytics
- State:
- Created a year ago
- Comments:10 (7 by maintainers)
Confirmed, not seeing the version appended for the script tag, which should be there due to
asp-append-version="true"
, in the published app.Non-published app:
Thanks for contacting us. We’re moving this issue to the
.NET 8 Planning
milestone for future evaluation / consideration. Because it’s not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it’s very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.