I have created a new .Net Core project using Visual Studio 22. Inside of my project I have created a new area (it was created successfully and works as expected).
Upon creating a new scaffolded item, all of the assets (controller & views) are created, however the code generated in my views is not aware of area they were created in.
For example my structure is /Areas/Admin/Flags
I can hit /Admin/Flags/Index just fine.
However, all of the links and form actions point to /Flags/[Action]
It's as if the scaffolding engine was not aware that I was creating these assets inside of an area.
Any ideas?
Make sure
app.UseEndpointswithareain the pattern is an early middleware extension in/program.cs. I added right belowapp.UseAuthorization();It will automatically utilize the area in the route.
Also, don't forget to copy
_ViewImports.cshtmlinto the root of the/areas/[area]/Viewsfolder, else links won't be clickable.