Skip to content

License Header Definitions

FlorianDecker edited this page Feb 1, 2018 · 6 revisions

The actual license headers are defined in .licenseheader files. You can add such a file to your project by right-clicking on the project in the solution explorer and selecting Add New License Header Definition File To Project in the License Headers sub menu. You can also add an existing file which can be useful if you want to share your license header definitions between projects.

Since 2.0.3 it is possible to add a solution wide header definitions file, which can be used if you want to apply your license header definitions to all projects in your solution. It can be created by right-clicking on the solution in the solution explorer. For more information on solution wide header definition files, see here.

The structure of the file is quite simple:

It starts with the keyword extensions: followed by a list of file extensions (separated by whitespaces). Everything below this line until the next line starting with extensions: will be inserted into the files with the given extensions.

For example

extensions: .cs 
#region copyright
// This is a sample license header.
#endregion
extensions: .aspx .ascx
<%-- This is a sample license header. --%>

will insert the text

#region copyright
// This is a sample license header.
#endregion

into .cs files and

<%-- This is a sample license header. --%>

into .aspx and .ascx files.

It is not possible to add empty, uncommented lines in the middle of the license text

extensions: .cs
// This is an 

// invalid license header.

If you want to have newlines in your license, comment the empty lines

extensions: .cs
// This is a 
//
// valid license header.

If you don't want license headers in the code-behind files of your ASP pages and controls, use the following license header definition (which inserts an empty header in the code-behind files):

extensions: .aspx.cs .ascx.cs 
extensions: .cs 
#region copyright
// This is a sample license header.
#endregion
extensions: .aspx .ascx
<%-- This is a sample license header. --%>

See also Expandable Properties.