CodeRush enables you to add a comment with context-dependent elements to the beginning of the file. You can use this feature to add an author and a license to all source code files in your solution:
- Open the CodeRush | Code Templates... window.
Focus the 1-key | h template.
Customize the template. You can use Text Commands and String Providers to add variable strings into it (for example, the file path). For example, add an MIT license to your code:
Test the new template: open a source file and add a copyright header to it. You can execute the Add Copyright Header code provider or expand the h template on the first line:
Add a License to All Project Files
Enable the Add copyright header cleanup provider and run Code Cleanup:
- Open the Editor | C# | Code Cleanup options page.
- Check the Add copyright header item in the cleanup refactorings/providers list.
- Uncheck the items you do not need.
Clean up your project: