Managed C++ Assembly Attributes
-
03-07-2019 - |
Question
Is there a way to add assembly attributes to a Managed C++ assembly? In a typical C# project, there is usually a line of code in the AssemblyInfo.cs
file like the following one:
[assembly: AssemblyTitle("Some Assembly")]
I have a private assembly attribute that I want to add (not one of the version attributes that could be added through a resource file), and I am not sure if this is possible.
Solution
It is possible - the easy way is to add an AssemblyInfo.cpp file and put:
#include attributes.h //your attribute decl
[assembly: MyCustomAttribute()];
It can be in any file you want, though.
edit - added required semicolon for assembly attribute
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow