Change Project Namespace in Visual Studio

后端 未结 7 1351
星月不相逢
星月不相逢 2020-12-08 03:47

How can I change the project namespace in Visual Studio?

The namespace is currently WindowsFormsApplication16, and I want the namespace to be MyNa

相关标签:
7条回答
  • 2020-12-08 04:00

    Right click properties, Application tab, then see the assembly name and default namespace

    0 讨论(0)
  • 2020-12-08 04:09

    "Default Namespace textbox in project properties is disabled" Same with me (VS 2010). I edited the project file ("xxx.csproj") and tweaked the item. That changed the default namespace.

    0 讨论(0)
  • 2020-12-08 04:11

    Instead of Find & Replace, you can right click the namespace in code and Refactor -> Rename.

    Thanks to @Jimmy for this.

    0 讨论(0)
  • 2020-12-08 04:18

    Assuming this is for a C# project and assuming that you want to change the default namespace, you need to go to Project Properties, Application tab, and specify "Default Namespace".

    Default namespace is the namespace that Visual studio sets when you create a new class. Next time you do Right Click > Add > Class it would use the namespace you specified in the above step.

    0 讨论(0)
  • 2020-12-08 04:20

    You can change the default namespace:
    -> Project -> XXX Properties...
    On Application tab: Default namespace

    Other than that:
    Ctrl-H
    Find: WindowsFormsApplication16
    Replace: MyName

    0 讨论(0)
  • 2020-12-08 04:23

    Just right click on the name you want to change (this could be namespace or whatever else) and select Refactor->Rename...

    Enter new name, leave location as [Global Namespace], check preview if you want and you're done!

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