共用方式為


Extern element

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The Extern element references any external header (.h) files to merge with the .vsct file at compile time. The files to be merged must be on the Include path given to the VSCT compiler or referenced by an Include element. The files may be other .vsct files or C++ header files.

Definitions in header files must be of the form "#define [Symbol] [Value]" The value may be another symbol if it is previously defined. Definitions may be used in conditional statements of command items. Any symbol not actually used will be discarded.

CommandTable Element Extern Element

Syntax

<Extern href="stdidcmd.h" />

Attributes and elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
href Required. The path to the header file:

href="stdidcmd.h"
Condition Optional. See Conditional attributes.
language Optional. The default language of all <Strings> elements in the command table:

language="en-us"

Child elements

Element Description
None. None.

Parent elements

Element Description
CommandTable element Defines all of the elements that represent commands — that is, menu items, menus, toolbars, and combo boxes — that a VSPackage provides to the IDE.

Example

<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-
  18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <Extern href="C:\VSCore\vscommon\inc\vsshlids.h"/>
    ...
  <Commands package="guidMyPackage">
</CommandTable>

See also