tags:

views:

432

answers:

2

Setting CLS compliance for an entire .NET assembly is possible. But how is it actually done? E.g. with Visual Studio 2008?

+6  A: 

You need to add this line to one of your source files:

[assembly: CLSCompliant(true)]

More info on CLS compliant code here.

Michael
Where does that line go? Into some particular file? Into all source files that contribute to an assembly?Regards, Peter
Peter Mortensen
No particular file. The attribute applies to the entire assembly the source code is compiled into.More details at the link I posted.
Michael
Generally you'd put this in your Properties/AssemblyInfo.cs file.
Craig
+3  A: 

Visual Studio adds a directive for the compiler, and the compiler checks the code for some more strict rules than in the native programming language.

You can add CLS compilant to all your project by adding the assembly level attribute

[assembly: CLSCompliantAttribute(true)]

anywhere in your project, generally in the assemblyinfo.cs file.

pocheptsov