Search code examples
c#visual-studio-2008stylecop

StyleCop SA1638


I am using StyleCop in VS2008. I get this error:

SA1638: The file attribute in the file header's copyright tag must contain the name of the file.

Here is my header.

// <copyright file="AssemblyInfo.cs" company="company">
// Copyright (c) company. All rights reserved.
// </copyright>
// <author>me</author>
// <email>me@me.com</email>
// <date>2010-03-04</date>
// <summary>blah blah.</summary>

I suspect the problem is that my AssemblyInfo.cs is located inside the Properties folder. Any clues to how I can fix this warning without silencing StyleCop?


Solution

  • Select the file in Solution Explorer, open the right-click Properties window, copy the text in the "File Name" area, paste that into the header.

    The Properties directory shouldn't matter, I'd assume you've got a typo in there somewhere.

    Addition:
    If that doesn't work, then to fix it you'll have to take it to the next level.
    Copy the whole project to a new solution, re-scan with StyleCop.
    Delete all unrelated files, re-scan with StyleCop.
    Delete all code in the problem file except the header, re-scan with StyleCop.
    If the problem disappears somewhere along the way, that would be really weird.
    If the problem doesn't disappear, then you've got a reproducible sample!

    Zip up that sample and attach it to a new work item here: http://code.msdn.microsoft.com/sourceanalysis/WorkItem/List.aspx

    Given some time there will likely be a new release to fix the bug. 8 )