The difference between setting <Assembly: CLSCompliant(False)> and related to CLS compliance compiler warnings in NoWarn

StackOverflow https://stackoverflow.com/questions/21131924

Question

When VB.NET assembly is CLS-sompliant and some types inside it are not, the compiler shows not CLS-compliant type warnings (codes 40025, 40026, 40027, 40028). In case I know about this non-compliance and fine with it, I want to hide the warnings. It is possible to do it in two ways: 1. Edit the project file and add the warnings to <NoWarn></NoWarn> section. 2. Edit the AssemblyInfo and set <Assembly: CLSCompliant(False)>.

Does anyone know about the upsides, downsides and possible consequences of these two approaches?

Was it helpful?

Solution

If you just want to hide warnings about CSL-compliancy, just use <NoWarn/> tags: it means that you don't care how CSL-compliancy of your code.

By using explicitly <Assembly: CLSCompliant(True/False)>., you clearly take a decision about the design/architecture of your code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top