Share via


Configuring File Header Company and Copyright

It is possible to control the company name and copyright text that is required within the file header at the top of every C# source file. A typical file header looks like the following:

//-----------------------------------------------------------------------

// <copyright file="Widget.cs" company="Sprocket Enterprises">

// Copyright (c) Sprocket Enterprises. All rights reserved.

// </copyright>

//-----------------------------------------------------------------------

 

By default, StyleCop will ensure that a company tag is present and filled in, and that the copyright text is filled in, but it will allow any text within these fields. By configuring the settings, it is possible to specify required text which must appear in these fields.

 

First, read this article to learn how to bring up the settings dialog for a particular project. Bring up the settings dialog for a project, and select the Company Information tab, as shown below:

Company Information

To control the company name and\or copyright text that must appear within the file headers, check the "Specify the company name and copyright..." checkbox, then fill in your company name and copyright string. For example:

Company Information Filled In

Within a typical company, it is a good idea to create a parent settings file at the root of your source tree, and specify these settings within that root settings file rather than at the project level. Doing this will ensure that these text strings are required for every C# source file within your entire source tree. The process for creating a parent settings file is decribed here.