Moving whole project to other namespace

We currently have a need to move few projects to completely another default
namespace. At the moment I can't find a way to do this at ReSharper and
propably it's impossible without considerable amount of handwork. I would
love to see this feature in coming versions.


9 comments
Comment actions Permalink

Hello Juha,

could you please clarify what do you need? Presumably, types in different
projects are in different namespaces, so this transformation would
require specifying a pattern for matching old namespace and new namespace.
Sorry if I'm missing something...


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

We currently have a need to move few projects to completely another
default namespace. At the moment I can't find a way to do this at
ReSharper and propably it's impossible without considerable amount of
handwork. I would love to see this feature in coming versions.



0
Comment actions Permalink

It is already possible to rename a complete namespace, all
class/interface declaarations will be moved to that namespace.

Or isn't that what you mean?

Just put your cursor somewhere in a namespace and press F2.
You do however have to rename your projects, and change the default
namespace in the project configuration.

Wiebe

Juha Luotio wrote:

We currently have a need to move few projects to completely another default
namespace. At the moment I can't find a way to do this at ReSharper and
propably it's impossible without considerable amount of handwork. I would
love to see this feature in coming versions.

0
Comment actions Permalink

Hello Wiebe,

Frequently, you need to move project to namespace, not rename all namespaces.
E.g:

Project1: Company.Subsystem1.Feature1
Project2: Company.Subsystem1.Feature2

You need to move project1 to Company.Subsystem2.Feature1
You can't just rename namespace, because it will move project2 to different
namespace as well.

The solution could be to temorary unload projects that should keep their
namespaces, perform rename and load projects back.

Sincerely,
Ilya Ryzhenkov


WT> It is already possible to rename a complete namespace, all
WT> class/interface declaarations will be moved to that namespace.
WT>
WT> Or isn't that what you mean?
WT>
WT> Just put your cursor somewhere in a namespace and press F2.
WT> You do however have to rename your projects, and change the default
WT> namespace in the project configuration.
WT> Wiebe
WT>
WT> Juha Luotio wrote:
WT>
>> We currently have a need to move few projects to completely another
>> default namespace. At the moment I can't find a way to do this at
>> ReSharper and propably it's impossible without considerable amount of
>> handwork. I would love to see this feature in coming versions.
>>


0
Comment actions Permalink

Hello Wiebe,

Frequently, you need to move project to namespace, not rename all
namespaces. E.g:

Project1: Company.Subsystem1.Feature1
Project2: Company.Subsystem1.Feature2
You need to move project1 to Company.Subsystem2.Feature1
You can't just rename namespace, because it will move project2 to
different
namespace as well.
The solution could be to temorary unload projects that should keep
their namespaces, perform rename and load projects back.


This will omit possible references in the unloaded projects to the project
being refactored.


0
Comment actions Permalink

Hi Ilya,

Ah, I get it. Yes i've faced this problem as well.

A feature I'd like is R# to indicate in *.cs that the namespace doesn't
conform to this format: [project default
namespace].[subfolder1].[subfolder2] with an automatic fix to rename the
namespace.

Similar to how Java requires your structure to be, except that I do use
subfolders that don't always indicate namespaces.

for example, I can have this structure

MyCompany/MyProduct/Web/UI/Exceptions/MyException.cs

where the MyException class is still defined in the
MyCompany.MyProduct.Web.UI namespace.

Generally I try to structure my namespaces similar to the file/folder
hierarchy, but using R# features the namespaces become quickly out of
sync, because of the following use case:

- automatically create non-existing classes (new NonExistentClass())
- [manually replace 'internal' with 'public' <-- feature request :)]
- use F6 to move the classes to a separate file
- move the file to the appropriate project/subfolder

most of the time, the namespace isn't correct anymore after moving it,
which means this error often goes unnoticed by me (thanks to R# I never
have to type using clauses anymore, contrary to my non-R#-using-collegues).

2cts... :)

Regards, Wiebe


Ilya Ryzhenkov wrote:

Hello Wiebe,

Frequently, you need to move project to namespace, not rename all
namespaces. E.g:

Project1: Company.Subsystem1.Feature1
Project2: Company.Subsystem1.Feature2

You need to move project1 to Company.Subsystem2.Feature1
You can't just rename namespace, because it will move project2 to
different namespace as well.

The solution could be to temorary unload projects that should keep their
namespaces, perform rename and load projects back.

Sincerely,
Ilya Ryzhenkov


WT> It is already possible to rename a complete namespace, all
WT> class/interface declaarations will be moved to that namespace.
WT> WT> Or isn't that what you mean?
WT> WT> Just put your cursor somewhere in a namespace and press F2.
WT> You do however have to rename your projects, and change the default
WT> namespace in the project configuration.
WT> Wiebe
WT> WT> Juha Luotio wrote:
WT>

>>> We currently have a need to move few projects to completely another
>>> default namespace. At the moment I can't find a way to do this at
>>> ReSharper and propably it's impossible without considerable amount of
>>> handwork. I would love to see this feature in coming versions.
>>>


0
Comment actions Permalink

I would live this feature!
--
Gabriel Lozano-Moran
The .NET Aficionado
http://www.pointerx.net


"Dmitry Lomov (JetBrains)" <dmitry.lomov@jetbrains.com> wrote in message
news:c8a8949e29f58c88f7bf99068f5@news.intellij.net...

Wiebe,

>
>> Ah, I get it. Yes i've faced this problem as well.
>>
>> A feature I'd like is R# to indicate in *.cs that the namespace
>> doesn't conform to this format: [project default
>> namespace].[subfolder1].[subfolder2] with an automatic fix to rename
>> the namespace.
>

In fact, internall we already have this feature :)
We will see whether we can make it available as a plugin

>

Friendly,
Dmitry

>

--
Dmitry Lomov
Senior Software Developer
JetBrains, Inc.
"Develop With Pleasure!"

>



0
Comment actions Permalink

Nice!

Dmitry Lomov (JetBrains) wrote:

Wiebe,

>> Ah, I get it. Yes i've faced this problem as well.
>>
>> A feature I'd like is R# to indicate in *.cs that the namespace
>> doesn't conform to this format: [project default
>> namespace].[subfolder1].[subfolder2] with an automatic fix to rename
>> the namespace.


In fact, internall we already have this feature :)
We will see whether we can make it available as a plugin

Friendly,
Dmitry

--
Dmitry Lomov
Senior Software Developer
JetBrains, Inc.
"Develop With Pleasure!"

0
Comment actions Permalink

This would be a great feature. Refactoring assemblies.

0

Please sign in to leave a comment.