dibs487
dibs487

Reputation: 1364

What does "File has no header" build warning in visual studio mean

I'm building my project fine but two of the files in my unit test project give a build warning "File has no header." they're unrelated and otherwise unremarkable .cs files. I've googled but get swamped with results for "SA1633: The file has no header, the header Xml is invalid, or the header is not ...."

These warnings do not have an error code, what could they mean?

Upvotes: 4

Views: 12574

Answers (2)

Anton V Kovalchuk
Anton V Kovalchuk

Reputation: 35

Add to header:

// <auto-generated />

A file that is completely auto-generated by a tool, and which should not be checked or enforced by StyleCop, can include an “auto-generated” header rather than the standard file header. This will cause StyleCop to ignore the file. This type of header should never be placed on top of a manually written code file.

Upvotes: 1

k7s5a
k7s5a

Reputation: 1377

That´s a StyleCop code analysis violation.

This means that a C# source file is missing a file header.

The file header must begin on the first line of the file and must be formatted as a block of comments containing Xml, as follows:

//-----------------------------------------------------------------------
// <copyright file="NameOfFile.cs" company="CompanyName">
//     Company copyright tag.
// </copyright>
//-----------------------------------------------------------------------

Upvotes: 10

Related Questions