how to change namespace of entire project?

2019-01-30 07:07发布

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 now file located here:

MySolution\MyApp\DemoApp\ViewModel\MainWindowViewModel.cs

is using such namespace:

namespace DemoApp.ViewModel
{
/// <summary>
/// The ViewModel for the application's main window.
/// </summary>
public class MainWindowViewModel : WorkspaceViewModel

I need to move file here (remove DemoApp folder):

MySolution\MyApp\ViewModel\MainWindowViewModel.cs

and also to use right namespace:

namespace MyApp.ViewModel
{
....

how to do that in visual studio 2010?

Update ok here is possible duplicate Change Project Namespace in Visual Studio Now I know how to change the namespace of the project, but how to move files on the file system? (get rid of "DemoApp" folder)

8条回答
够拽才男人
2楼-- · 2019-01-30 08:04

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.

查看更多
forever°为你锁心
3楼-- · 2019-01-30 08:10

Just right click the solution, go to properties, change "default namespace" under 'Application' section.

enter image description here

查看更多
登录 后发表回答