ReSharper's Rename Refactoring and ASP.Net Core Tag Helpers

For those ReShaper users out there… watch ReSharper’s rename refactoring (Ctrl+R, R) when working with ASP.NET Core’s Tag Helpers. Why? ReSharper will NOT change the name of the property names in the “asp-for” part of the tag helper as part of the rename refactoring.

Renaming this property from “NumberOfVolunteersRequired” to “VolunteersRequired” using ReSharper:
ReSharperRename

Property name looks good:

RenameLooksGood

Rebuild all compiles:RebuildAllGood

Runtime error from Razor view that uses asp-for:
RazorViewError

Looking at the Razor view, the renamed property from the Create class has NOT been updated by ReSharper. The old name of NumberOfVolunteersRequired is still the value in asp-for:
BadReSharper

Granted, this is because ReShaper does not officially support ASP.NET Core yet (as it’s still going through going pains as evident by the latest RTM release). Here are some links if you’re brave enough to participate in ReSharper’s Early Access Builds. Who knows, maybe one of these early builds will fix this one issue.

UPDATE: 7/20/2016: From der Igel’s comment below, it looks like EAP builds of 2016.2 will take care of the tag helper property names

In the interim, make sure you’re watching your Razor views that use Tag Helpers when renaming via ReSharper

Michael McCarthy

Read more posts by this author.