Managed C++ Assembly Attributes

穿精又带淫゛_ 提交于 2019-12-21 09:26:51

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/158821/managed-c-assembly-attributes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!