Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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.

Example

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 {};

Community Additions

ADD
Show:
© 2015 Microsoft