Edit

Share via


Compiler Error C3099

'keyword': use [System::AttributeUsageAttribute] for managed attributes; use [Windows::Foundation::Metadata::AttributeUsageAttribute] for WinRT attributes

Use AttributeUsageAttribute to declare /clr attributes. Use Windows::Foundation::Metadata::AttributeUsageAttribute to declare Windows Runtime attributes.

For more information about /CLR attributes, see User-Defined Attributes. For supported attributes in Windows Runtime, see Windows.Foundation.Metadata namespace

Example

The following sample generates C3099 and shows how to fix it.

// C3099.cpp
// compile with: /clr /c
using namespace System;
[usage(10)]   // C3099
// try the following line instead
// [AttributeUsageAttribute(AttributeTargets::All)]
ref class A : Attribute {};