coderushforroslyn-120416-getting-started-examples-code-generation-how-to-add-a-license-to-code-files.md
The Add Copyright Header code provider and the h template allow you to add a copyright comment at the beginning of a source code file.
This comment can contain a file name, company name, author, and a license.
The following example shows how to customize the h template to add a license to a copyright comment.
Choose the CodeRush | Code Templates… item in the CodeRush menu to access the code templates options page.
Select the 1-key | h template.
Add a license to the default copyright header. For example, the MIT license:
Click OK to save the changes and close the Templates options page.
Open the IDE | User Info options page and configure the “Company”, “First Name”, and “Last Name” fields for the default copyright header:
Open a source file and perform one of the following actions:
Open the Editor | C# (Visual Basic) | Code Cleanup options page and choose the Add copyright header rule.
Configure the Add copyright header rule:
Clean up your project:
Note
If you do not want CodeRush to modify the existing copyright header after code cleanup, enable the Do not replace the existing copyright header during code cleanup option on the Editor | C# (Visual Basic) | Programming Style options page.