how to change namespace of entire project?

前端 未结 11 626
梦如初夏
梦如初夏 2020-12-22 22:30

I\'m modifying demo application from this article: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

I need to update all files to use my namespace, for example

相关标签:
11条回答
  • 2020-12-22 22:58

    In asp.net is more to do, to get completely running under another namespace.

    • Copy your source folder and rename it to your new project name.
    • Open it and Replace all by Ctrl + H and be sure to include all Replace everything
    • Press F2 on your Projectname and rename it to your new project name
    • go to your project properties and adjust it, coz everything has gone and you need to make a new Debug Profile Profile to Create
    • All dependencies have now an exclamation mark - restart visual studio
    • Clean your solution and Run it and it should work :)
    0 讨论(0)
  • 2020-12-22 23:00

    I know its quite late but for anyone looking to do it from now on, I hope this answer proves of some help. If you have CodeRush Express (free version, and a 'must have') installed, it offers a simple way to change a project wide namespace. You just place your cursor on the namespace that you want to change and it shall display a smart tag (a little blue box) underneath namespace string. You can either click that box or press Ctrl + keys to see the Rename option. Select it and then type in the new name for the project wide namespace, click Apply and select what places in your project you'd want it to change, in the new dialog and OK it. Done! :-)

    0 讨论(0)
  • 2020-12-22 23:05

    You can use CTRL+R, CTRL+R or for complex namespace changes use this tool https://marketplace.visualstudio.com/items?itemName=vs-publisher-599079.FixNamespace

    0 讨论(0)
  • 2020-12-22 23:05

    You can use ReSharper for namespace refactoring. It will give 30 days free trial. It will change namespace as per folder structure.

    Steps:

    1. Right click on the project/folder/files you want to refactor.

    2. If you have installed ReSharper then you will get an option Refactor->Adjust Namespaces.... So click on this.

    It will automatically change the name spaces of all the selected files.

    0 讨论(0)
  • 2020-12-22 23:07

    I imagine a simple Replace in Files (Ctrl+Shift+H) will just about do the trick; simply replace namespace DemoApp with namespace MyApp. After that, build the solution and look for compile errors for unknown identifiers. Anything that fully qualified DemoApp will need to be changed to MyApp.

    0 讨论(0)
提交回复
热议问题