Move hardcoded strrings to resource files in .cshtml documents.


In an core applicatoin I need to use the "Move to resource" tool to localize strings.  The operation is available as a refacgtor when I select a hardcoded string in c# code, but it is not available in razor cshtml files.

Is there any way to enable this operaiton in cshtml files? I need to extract a lot of resources from cshtml files.  The whole "refactor" tool seems to be off in cshtml files.


Comment actions Permalink



Could you please provide some screenshots and video demonstrating the issue with moving to resources in cshtml? Is there any chance you could provide a sample solution in which the problem is reproduced? You can share the information via "Submit a request" form or using our upload service.

Thank you.

Comment actions Permalink

Sure. I uploaded a video. You will see first how the Refactor>>Move menu is available when I select a hardcoded text in a c# class.

And then you will see how the Refactor Move operation is not available in a chunk of text of a razor page.

Upload id: 2022_09_28_XwJEmdqhvYVBP8bXVyYjEg (file: no refactor 2022-09-28_17-08-16.mp4)

Thank you for having a look into it,


Comment actions Permalink

Hell Dani,


thank you for the provided info.

Currently, "Move to resource" refactoring is not supported for html part of cshtml files, here's a corresponding feature request - You are welcome to comment or vote for it.


Please sign in to leave a comment.