开发者

Help me undo (accidental)namespace rename in VS 2010

I did a bad thing, and I need help undoing it, because I don't know where to make the correction and don't want to further mess things up.

I have an ASP.NET MVC3 solution in VS 2010 with three projects.

In one of the projects, I have three folders, each with several files in them.

I realized that I mistakenly created a file in the wrong folder, so I dragged it into the correct folder.

After I did this, I renamed the namespace by typing in the right one, referencing the folder I just moved it into.

When I did that, the magic cursor, or whatever it's called, appeared under the new text I just typed in...so I hovered. It asked me if I wanted to rename from the old value to the new one I just typed in. So, I click yes.

I think a number of you already know what that means, but I hadn't a clue. Yes, I'm new at this. :)

All using statements in my solution referencing the original folder have been renamed in the process. The original folder is no longer available 开发者_StackOverflow中文版in any using statements I try to add.

Also of note, I had no clue what was doing this and thought my solution was corrupt or something, so I cleaned, and built, and rebuilt, and rebooted...so undo isn't an option.

What are my options for getting back to "normal" in my solution? Thanks!

UPDATE, PROBLEM SOLVED:

All I had to do was rename the bad folder so I could create a new folder in the project with the bad folder's original name. I then moved the files from the bad folder into the new folder and corrected their namespaces.

Trashed the old folder. Updated using statements. Built the solution. All is well.

I was afraid the rename went a lot deeper than it did. I'm not certain why this worked, but thank god it did.

Thanks to all who replied. I'll be exploring SVN this evening!


for example, you have tow folders named: Views and ViewModels in your project that named MyMvcProject; your namespaces will be MyMvcProject.Views and MyMvcProject.ViewModels; and you rename the MyMvcProject.Views to MyMvcProject.ViewModels; to undo, first exclude the folder named ViewModels - right-click on it, and select Exclude From Project; now open the find and replace window - Ctrl + f - select Quick Replace tab, in Find what textbox type .ViewModels and in Replace with textbox type .Views; set Look in to Current Project and click Replace All; now must all ViewModels in project - not old viewmodels, because you exclude the ViewModels folder from project - be replaced with Views; now, include the excluded folder (ViewModels) and rebuild the project; if you got an error about namespace of any type, insert this using statement:

using MyMvcProject.Views;

regards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜