Back to Devexpress

Add Copyright Header

coderushforroslyn-120408-coding-assistance-code-providers-add-copyright-header.md

latest2.3 KB
Original Source

Add Copyright Header

  • Aug 03, 2020
  • 2 minutes to read

Purpose

Adds a copyright comment at the file’s beginning.

Availability

Available when the caret is in the first line of a source code file.

How to Use

  1. Select the CodeRush | Options… item in the Visual Studio’s menu and open the IDE | User Info options page.

  2. Configure the First Name , Last Name , and Company fields on the User Info options page.

  3. Open a source code file.

  4. Place the caret at the first line.

  5. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu and select Add Copyright Header from the menu.

After execution, the Code Provider adds a copyright comment.

csharp
//-----------------------------------------------------------------------
    // <copyright file="D:\Projects\CodeRushDemo\CodeRushDemo\Program.cs" company="Developer Express">
    // Author: CodeRush User
    // Copyright (c) Developer Express. All rights reserved.
    // </copyright>
    //-----------------------------------------------------------------------

    using System;
    using System.Collections.Generic;
    // ...
vb
'-----------------------------------------------------------------------
    ' <copyright file="D:\Projects\CodeRushDemo\CodeRushDemo\MainModule.vb" company="Developer Express">
    ' Author: CodeRush User
    ' Copyright (c) Developer Express. All rights reserved.
    ' </copyright>
    '-----------------------------------------------------------------------

    Imports System
    Imports System.Collections.Generic
    ' ...

You can also use the h template to add the Copyright Header ‘s text. Refer to the Copyright Header topic for details.

Note

This feature is available as a part of Code Cleanup.

See Also

How to: Add a License to Code Files