共用方式為


[Content_types].xml (VSIX Deployment)

Contains information about the kinds of content in a VSIX package. Extension Manager uses the [Content_Types].xml file to install the package, but it does not install the file itself.

注意

Although this topic applies only to [Content_Type].xml files that are used in VSIX packages, the [Content_Types].xml file type is part of the Open Packaging Conventions (OPC) standard. For more information, see OPC: A New Standard For Packaging Your Data on the MSDN Web site.

Attributes and Elements

The following sections describe the root element and its attributes and child elements.

Dd997170.collapse_all(zh-tw,VS.110).gifRoot Element

Element

Description

Types

Contains child elements that enumerate the file types in the VSIX package.

Dd997170.collapse_all(zh-tw,VS.110).gifAttributes

Attribute

Description

Xmlns

(Required.) The location of the schema used for this [Content_Types].xml file.

Dd997170.collapse_all(zh-tw,VS.110).gif{Attribute name} Attribute

Value

Description

http://schemas.openformats.org/package/2006/content-types

The location of the content types schema.

Dd997170.collapse_all(zh-tw,VS.110).gifChild Elements

The Types element can contain any number of Default elements.

Element

Description

Default

Describes a content type in the VSIX package. Every file type in the package must have its own Default element.

Dd997170.collapse_all(zh-tw,VS.110).gifAttributes

Attribute

Description

Extension

The file name extension of a file in the VSIX package.

ContentType

Describes the kind of content that is associated with the file name extension.

Dd997170.collapse_all(zh-tw,VS.110).gif{Attribute name} Attribute

Visual Studio recognizes the following ContentType values for the associated Extension types.

Extension

ContentType

txt

text/plain

pkgdef

text/plain

xml

text/xml

vsixmanifest

text/xml

htm or html

text/html

rtf

application/rtf

pdf

application/pdf

gif

image/gif

jpg or jpeg

image/jpg

tiff

image/tiff

vsix

application/zip

zip

application/zip

dll

application/octet-stream

all other file types

application/octet-stream

Example

Dd997170.collapse_all(zh-tw,VS.110).gifDescription

The following [Content_Types].xml file describes a typical VSIX package.

Dd997170.collapse_all(zh-tw,VS.110).gifCode

<?xml version="1.0" encoding="utf-8" ?> 
<Types xmlns="https://schemas.openxmlformats.org/package/2006/content-types">
    <Default Extension="vsixmanifest" ContentType="text/xml" /> 
    <Default Extension="dll" ContentType="application/octet-stream" /> 
    <Default Extension="png" ContentType="application/octet-stream" /> 
    <Default Extension="txt" ContentType="text/plain" /> 
    <Default Extension="pkgdef" ContentType="text/plain" /> 
</Types>

See Also

Other Resources

Anatomy of a VSIX Package

VSX Schema for Extensions

OPC: A New Standard For Packaging Your Data