views:

261

answers:

2
+3  Q: 

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?

+4  A: 

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 )

Task
+2  A: 

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)?

bdukes