-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-css-isolationThis issue is related to CSS Isolation featureThis issue is related to CSS Isolation featurefeature-runtime-compilation
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Enabling razor runtime compilation in an ASP.NET Core 6 MVC project prevents the CSS Isolation feature from generating css-scope attributes in Layout/View tags.
Expected Behavior
Razor runtime compilation should auto-generate the CSS Isolation attributes similarly to running without runtime compilation.
Steps To Reproduce
- In Visual Studio 2022 Professional create a new Asp.Net Core Wep App (Model-View-Controller) project.
- Run the project and view source
- Confirm tags in _Layout have auto-generated scope attributes and stop debugging
- Add the nuget package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation 6.0.6
- Update the environment variables section in your launchSettings.json file to this
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
},
- Run the project again and view source
- Confirm that the auto generated scope attributes are no longer injected into the Layout tags
I understand this is probably a very complex problem to solve. But it leaves the developer with the choice of either using CSS Isolation (which is really cool) OR runtime compilation which is crucial for a good ASP.NET development experience.
Thanks,
James
Exceptions (if any)
No response
.NET Version
6.0.31
Anything else?
Reference to closed issue #33446:
hsuanhan, ernestopye, zotanmew and connorLaderer
Metadata
Metadata
Assignees
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-css-isolationThis issue is related to CSS Isolation featureThis issue is related to CSS Isolation featurefeature-runtime-compilation