views:

26

answers:

2

Hi,

Does anyone know a quick and foolproof way of changing the namespace of a VS2008 solution/projects? In other words - I have a solution, and want to copy this as a template for a different application, but need different namespace obviously.

Thanks

A: 

Open the search & replace dialog:

Shift+Ctrl H

Find what: namespace YOUROLDNAMESPACE

Replace what: namespace YOURNEWNAMESPACE

Look in: Entire solution

Find options:

Tick Match case Tick Match whole word

Push button "Replace All"

HTH Dimi

Greco
This is what I have done in the past, but it doesn't take into account file names, interproject references etc. I wish VS would provide proper support for this!
UpTheCreek
Upthecreek, you just gave me an idea... If all your projects are in a source control... Then Dimi's method can work.Just work in the source control rather than VS (just remember to start changing the sub project first and the main last + write on paper the names of the sub project so that you can test them... or at least understand what's wrong with them later if there are bugs)
Asaf
@Asaf: Hmm, It is in source control - I'll try that, thanks.
UpTheCreek
A: 

Renaming Solution name will not affect namespace of projects in it.
If you want to change namespace - right click project file -> select "properties" -> select "Application" tab -> Change "default namespace".

Only best fool proof way in my opinion

  • Open solution in VS2008
  • Open Solution Explorer
  • Right Click Solution
  • Select "Rename"
Sandy
This will not help with all the files inside the solution that have a namespace that now needs to be changed.
Oded