托管C ++程序集属性属性、程序

2023-09-03 07:00:56 作者:抽烟请举手i

有没有办法来添加组件属性到一个托管C ++组件?在一个典型的C#项目,通常有一条线的code中的的AssemblyInfo.cs 文件类似以下:

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:

[总成:AssemblyTitle(一些大会)]

我有,我想补充(而不是那可以通过一个资源文件中添加的版本属性之一)的私人集会属性,我不知道这是可能的。

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.

推荐答案

这是可能的 - 最简单的方法是添加一个AssemblyInfo.cpp文件,并把:

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