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

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

Photo by Brett Jordan on Unsplash

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 “VolunteerReSharperRename](http://www.michaelgmccarthy.com/content/images/2016/07/resharperrename.pngRenameLooksGood](http://www.michaelgmccarthy.com/content/images/2016/07/renamelooksgoRebuildAllGood](http://www.michaelgmccarthy.com/content/images/2016/07/rebuildallgood.png)

Runtime error from RaRazorViewError](http://www.michaelgmccarthy.com/content/images/2016/07/razorviewerror.png)

Looking at the Razor view, the renamed property from the Create class has NOT been updated by ReSharper. The old name of NumberOfVolunteersRequired is BadReSharper](http://www.michaelgmccarthy.com/content/images/2016/07/badresharper.png)

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

Show Comments