Classes used in Razor code are not renamed when refactoring

When I got some classname used in Razor code, like this and I rename this class (DetailViewModel) by changing the name and using Ctrl+dot, classes in Razor code are not renamed. This is by my opinion major bug.
@model MvcWeb.Models.DetailViewModel

4 comments

On 29.06.2011 18:10, Martin Suchan wrote:

  When I got some classname used in Razor code, like this and I rename this class (DetailViewModel) by changing the name and using Ctrl+dot, classes in Razor code are not renamed. This is by my opinion major bug.
@model MvcWeb.Models.DetailViewModel


Martin, I can't repeat your issue. All classes are renamed fine. Can you provide more details or small repro project?

0

Ok, I've completely cleaned my solution (removed R# cache and build files), opened solution in VS 2010, opened EditGroup.cshtml file in Views/Product - the top line defininig the model is:
@model <appname>.Model.Entities.Group
I've opened the file Group.cs in <appname>.Model project in Entities/ folder, renamed the class to GroupX, pressed Ctrl+'dot' and selected 'Rename 'Group' to 'GroupX'' - refactoring was made, I switched back to EditGroup.cshtml, but the top line was still
@model <appname>.Model.Entities.Group
and several lines of this file was in red - class not found.
W7 x64 SP1, VS2010 SP1, ASP.NET MVC 3, R# 6 RC2

0

Ctrl+dot is Visual Studio SmartTag activation command, and that means that
you used VS rename refactoring. Try using ReSharper refactoring commands.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> Ok, I've completely cleaned my solution (removed R# cache and build
IR> files), opened solution in VS 2010, opened EditGroup.cshtml file in
IR> Views/Product - the top line defininig the model is:
IR>
IR> @model  http://devnet.jetbrains.net/message/5307886#5307886


0

Good to know, thanks (I guess there is no way fixing this VS behavior in R#, maybe posting bug report somewhere on Microsoft Connect site?)

0

Please sign in to leave a comment.