Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>[email protected]</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?

like image 733
niaher Avatar asked Mar 04 '10 18:03

niaher


2 Answers

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 )

like image 166
Task Avatar answered Oct 10 '22 17:10

Task


I have the following for an AssemblyInfo.cs file in the Properties folder:

// <copyright file="AssemblyInfo.cs" company="company">
// product
// Copyright (c) 2004-2010
// by company ( http://www.example.com )
// </copyright>

And it doesn't have any problems with that. Are you sure that you the file name is correct (maybe casing is off?) and that you don't have any invalid XML (an ampersand in your company name, perhaps)?

like image 29
bdukes Avatar answered Oct 10 '22 18:10

bdukes