Tuesday, February 24, 2009

Removing the "warning CS3008: Identifier '__ASP' is not CLS-compliant" warning

I'd been getting "warning CS3008: Identifier '__ASP' is not CLS-compliant" when building a ASP.NET 2.0 website.

Compiler Warning (level 1) CS3008 occurs when:

A public, protected, or protected internal identifier breaks compliance with the Common Language Specification (CLS) if it begins with an underscore character (_).

In my case I was able to remove this warning by changing the CLSCompliantAttribute in the AssemblyInfo.cs of the website.

[assembly: CLSCompliant(false)] //Used to be set to true.

Note: It is a bit odd having an AssemblyInfo.cs for a website. It was linked in using the CompilerOptions property in the masterpage.