How to move a class to another package?

In Visual Studio, I have many classes and UserControls that I need to move to another namespace. In eclipse, I can do this with updating all links automatically. In Visual Studio, I could not find a similar function. How is this possible in Visual Studio?

+4
source share
4 answers

Visual Studio does not have such features. Resharper has this feature.

+2
source

If you mean moving between assemblies:

For existing inline code, you must add:

[assembly:TypeForwardedTo(typeof(SomeNamespace.TheControl))] 

to the original assembly (which no longer contains TheControl ). Then the CLR will sort everything for you for existing built code without the need to update links.

However, to build the code, you still need to update the links; I do not think that vanilla VS has a built-in version.

+3
source

Renaming is supported in VS for a reference update, but not for moving files or classes.

+1
source

I recommend Resharper . This is a really powerful fos VS refactoring tool. VS becomes possible even after installing it;) And it has a tool for moving classes, methods, pulling up, clicking, renaming and many others.

+1
source

Source: https://habr.com/ru/post/1334479/


All Articles