如何在我的.NET代码中找到所有非CLS兼容的语句?

时间:2022-10-31 18:24:46

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

如何在我的.NET代码中找到所有非CLS兼容的语句?

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

Visual Studio 2015编译器能做到吗?如何找到不符合CLS的警告?

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

我检查了StyleCop ReSharper扩展和ndepend没有成功。

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.

我所追求的是在我的C#代码Visual Studio项目中找到所有非CLS兼容的语句。最终目标是向其添加[assembly:CLSCompliant(true)]标记。

Thanks.

谢谢。

1 个解决方案

#1


0  

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.

使用[assembly:CLSCompliant(true)]会使c#编译器在不符合CLS的代码上显示警告。 CLSCompliant警告的代码通常在CS3000范围内,因此您可以通过代码订购以检查所有这些警告。

#1


0  

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.

使用[assembly:CLSCompliant(true)]会使c#编译器在不符合CLS的代码上显示警告。 CLSCompliant警告的代码通常在CS3000范围内,因此您可以通过代码订购以检查所有这些警告。