How can I change the project namespace in Visual Studio?
The namespace is currently WindowsFormsApplication16
, and I want the namespace to be MyName
.
You could put the caret on a namespace declaration in your C# code and press F2 on the keyboard. This should let you change the name of the namespace across the entire project, including the XAML files.
Set your cursor into the namespace and then hit F2 to rename (if F2 didn't work, try CTRL R + CTRL R or rightclick - rename). All related namespaces should be changed.
Visual Studio assigns your project name as the default root namespace for all code in your project. For example, if your project is named Payroll , its programming elements belong to namespace Payroll . If you declare Namespace funding , the full name of that namespace is Payroll. funding .
You can change the default namespace:
-> Project
-> XXX Properties...
On Application tab: Default namespace
Other than that:Ctrl-H
Find: WindowsFormsApplication16
Replace: MyName
Instead of Find & Replace, you can right click the namespace in code and Refactor -> Rename.
Thanks to @Jimmy for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With