简体   繁体   中英

Code Cleanup - tool to move all using statements inside namespace in all cs files in my solution?

After writing a whole bunch of code - i am finally waking up to adding CA and StyleCop to my solution.

By default all files (a lot of them) in my solution have using statements at the top of the file before the namespace.

I have resharper 6.0 and powertools in visual studio. Is there a way using these or any other tool that will go through all my CS file in the solution and put the using statements inside the namespace for each file.

With Resharper it can be done in two steps.

  1. Set the checkbox "Add 'using' directive to the deepest scope" in Code EditingC#Code StyleReference qualification . 选件v9

  2. In the context menu of the solution choose "Cleanup Code...". SLN上下文菜单

You might want to create a custom cleanup pofile that suits your needs before performing the cleanup.

In ReSharper before v9 the setting is located somewhere else: 选件v8

In ReSharper 10 you can find it in: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM