dotnet / dotnet/aspnetcore

Tag Helpers not working in published site

Open
#44,216 10 comments 0 reactions 0 assignees View on GitHub
area-mvc bug
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] 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.

```














```

### Expected Behavior

Tag helpers, specifically src-include, work in a published app the same as in development.

### Steps To Reproduce

1. Create ASP Core Web API project with ASP Identity
2. Override some Identity pages, including the main _Layout.cshtml. Leaving the existing markup is fine.
3. 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

Contributor guide

Open the contributing guide

Research direction

Reproduce the published-app behavior using the Identity area override, _ViewStart.cshtml, and _Layout.cshtml described in the issue, comparing it with debugger output. Start by checking the rendering of the environment and script tags, especially asp-src-include and asp-append-version, in a .NET 6 published executable or IIS deployment. Done means the published app processes these tag helpers as it does during development.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.