VCCLCompilerTool.StructMemberAlignment 属性

为结构成员对齐指定 1, 2, 4, 8 或 16 字节边界。 StructMemberAlignment 公开 C++ 编译器的 /Zp(结构成员对齐) 选项和 MIDL 编译器的 MIDL 属性页:高级 选项的功能。

命名空间:  Microsoft.VisualStudio.VCProjectEngine
程序集:  Microsoft.VisualStudio.VCProjectEngine(在 Microsoft.VisualStudio.VCProjectEngine.dll 中)

语法

声明
Property StructMemberAlignment As structMemberAlignOption
structMemberAlignOption StructMemberAlignment { get; set; }
property structMemberAlignOption StructMemberAlignment {
    structMemberAlignOption get ();
    void set (structMemberAlignOption value);
}
abstract StructMemberAlignment : structMemberAlignOption with get, set
function get StructMemberAlignment () : structMemberAlignOption
function set StructMemberAlignment (value : structMemberAlignOption)

属性值

类型:Microsoft.VisualStudio.VCProjectEngine.structMemberAlignOption
一个 structMemberAlignOption 值。

备注

MIDL 工具不允许 16 字节边界。

示例

有关如何编译和运行此示例的信息,请参见 如何:编译项目模型扩展性示例代码

下面的示例在集成开发环境 (ide) 中修改编译器的 StructMemberAlignment 属性 (IDE):

' add reference to Microsoft.VisualStudio.VCProjectEngine.
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub Test()
        Dim prj As VCProject
        Dim cfgs, tools As IVCCollection
        Dim cfg As VCConfiguration
        Dim tool As VCCLCompilerTool
        prj = DTE.Solution.Projects.Item(1).Object
        cfgs = prj.Configurations
        cfg = cfgs.Item(1)
        tool = cfg.Tools("VCCLCompilerTool")
        tool.StructMemberAlignment = structMemberAlignOption.alignSixteenBytes
    End Sub
End Module

.NET Framework 安全性

请参见

参考

VCCLCompilerTool 接口

Microsoft.VisualStudio.VCProjectEngine 命名空间