How do I find all the non CLS-compliant statements in my .NET code?

419 Views Asked by At

How do I find all the non CLS-compliant statements in my .NET code?

Can Visual Studio 2015 compiler do it? How do I find non CLS-compliant warnings?

I've checked StyleCop ReSharper extension and ndepend without success.

What I am after is to find all the non CLS-compliant statements in my C# code Visual Studio project. The final goal is to add the [assembly: CLSCompliant(true)] tag to it.

Thanks.

2

There are 2 best solutions below

0
Pikoh On BEST ANSWER

Using [assembly: CLSCompliant(true)] would make the c# compiler to show warnings on not CLS-compliant code. The code for CLSCompliant warnings is usually in the CS3000 range, so you can order by code to check all of them.

3
ajr On

For VB.NET use this:

<Assembly: CLSCompliant(True)>

Also, don't forget to Build-Clean Solution and Build-Rebuild Solution after adding the above to the AssemblyInfo.vb file.