12
votes

I was toying with new Razor Pages in ASP .NET Core 2.0 and noticed some problems with IntelliSense.

When using tag helper for MVC controller I get usual help:

MVC with IntelliSense

However there is no such help for asp-page tag helper used in Razor Pages:

razor Pages with no help

Is this a problem with my Visual Studio or rather Razor Pages tags do not support it yet?

I use ASP .NET Core 2.0 with framework 4.7 on VS 2017 15.5.5.

1
Same for me: Visual Studio 2017 (15.9.2), asp.net core 2.1. Maybe there are any extensions?A K
@KiranJoshi This adds autocompletion of tag helpers, but this doesn't add autocompletion inside asp-page helper. PS. I've tried to disable Resharper and intellisense for asp-action was switched off. So, this question is not about visual studio issue, but feature request for Resharper: add intellisense for razor pages.A K
@AK So intellisense for asp-action is an R# feature... Nice to know!Michal Sznajder
Resharper feature request: youtrack.jetbrains.net/issue/RSRP-472405A K

1 Answers

1
votes

It seems IntelliSense for routes is not supported (yet I hope), but there is an interesting workaround for that - see Razor Pages Url tt File. The idea is to create some SitePages.tt file in your ASP.NET Core 2 project using Razor Pages to scan the /Pages folder and output a class with string properties to get the IntelliSense for routes:

<cancel-button asp-page="@SitePages.DashboardIndex"></cancel-button>