This documentation is archived and is not being maintained.

Compiler Error C3451

Error Message

'attribute': cannot apply unmanaged attribute to 'type'

A C++ attribute cannot be applied to a CLR type. See C++ Attributes Reference for more information.

For more information, see User-Defined Attributes.

This error can be generated as a result of compiler conformance work that was done for Visual C++ 2005: the uuid (C++ Attributes) attribute is no longer allowed on a user-defined attribute using CLR programming. Use GuidAttribute instead.

See Breaking Changes in the Visual C++ 2005 Compiler for more information.


The following sample generates C3451.

// C3451.cpp
// compile with: /clr /c
using namespace System;
[ attribute(AttributeTargets::All) ]
public ref struct MyAttr {};

[ MyAttr, helpstring("test") ]   // C3451
// try the following line instead
// [ MyAttr ]
public ref struct ABC {};