steve wrote:
I have the following property in one of my applications but when I do a build I get a warning saying that it is not CLS compliant.
Swatch is a class defined in a separate project/dll. I get the same problem on properties that use Enums defined in the same dll as
the swatch.
Add
[assembly: CLSCompliant(true)]
to the offending library's AssemblyInfo.cs, recompile, and fix any compiler
warnings that may result.
If you cannot change the original assembly, you can do two things: either
wrap all the types exposed in assembly #1 in internal types and do not
re-expose them (which is incredibly tedious) or throw in the towel and make
sure your own assembly is marked as not being CLS-compliant either. You can
do that, unsurprisingly, with
[assembly: CLSCompliant(false)]
CLS compliance is generally a good thing, and for a truly reusable library
it's almost essential, but you can live without it if necessary. On an
application assembly, it doesn't matter a whole lot, since you typically
won't be accessing types in it anyway, let alone from another CLR language.
--
J.