I have a solution that includes various C# projects, and I just now noticed that I can't change the default namespace on any of them.
When I go to Properties --> Application on any of the project and change the "Default Namespace" field, a fatal error dialog pops up that says:
exception of type 'system.runtime.interopservices.externalexception' was thrown
At this point Visual Studio becomes unusable, as I can't close it or leave the screen, every click or button combination I press makes the same dialog pop up. The only thing I can do is terminate VS with the task manager.
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!
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.
Right-click on the project name & click reload the project. Then rename the project name as highlighted below & save. It will automatically rename the .
I got around it by just renaming the <RootNamespace>
node in the .csproj
file
Maybe you should try to do this in another way:
Ctrl-H - Find: PreviousNameSpaceName Replace: NewNamespaceName
You can also right click the namespace in code and Refactor->Rename.
What is more: you can change the names of your projects, solutions, directories - etc. Namespaces, when adding new files, are generated using these names in fact.
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