none
Change all project name, references , assmebly name and namespaces in a solution

    Question

  •  

    I have a Solution in VS 2013 which has more than 50 projects. Projects are interlinked via one or more project  references.  I am required to change the project name , assembly name, namespace and reference name for projects in entire solution. I know how to do it one by one but that seems very time consuming. My project name and assembly names are in pattern and in correlation with existing names, so if there is any way to global find replace , that would make more sense to me.

    Can some one please help me in achieving this goal.

    Thanks

    Bhim


    BSR

    Sunday, January 29, 2017 1:55 PM

All replies

  • There are several approaches:

    - You can select all the projects in the Solution Explorer and right-click Unload Project. Then you need to right-click Edit <Project> one by one (there is no way to select all and right-click Edit). Then you have all the project files opened in Visual Studio and you can change project names, assembly names, references, etc. When done, right-click "Reload"

    - You can do the same using a multi-document editor, such as Notepad++, that allows Find/Replace across all them

    - If you need something more automated, you need to use a macro, add-in (still available on VS 2013) or package that uses Visual Studio automation (EnvDTE) to iterate the projects of the solution, references, etc. and make changes. You have resources to do this on my website:

    http://www.visualstudioextensibility.com/articles/add-ins/

    (specially the "Articles about getting information" section)


    My portal and blog about VSX: http://www.visualstudioextensibility.com<br/> Twitter: https://twitter.com/VSExtensibility<br/> MZ-Tools productivity extension for Visual Studio: https://www.mztools.com


    Sunday, January 29, 2017 9:59 PM
  • Hi Bhim,

    Also, you could get the trial version of Resharper and use the available refactoring tools to change all namespace.

    Then follow the steps below:

    1. Manually edit your project files to have the new name (or do it with find/replace)
    2. Reopen the solution in visual studio
    3. Right click on the solution > Refactor > Adjust namespaces

    Best regards,

    Fletch


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 31, 2017 3:04 AM