The requested page is not available for the requested platform. You are viewing the content for Default platform.

How To Add a License to Code Files

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:

  1. Open the CodeRush | Code Templates... window.
  2. Focus the 1-key | h template.


  3. 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:


  4. 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:

  1. Open the Editor | C# | Code Cleanup options page.
  2. Check the Add copyright header item in the cleanup refactorings/providers list.
  3. Uncheck the items you do not need.
  4. Clean up your project: