[Content_types].xml 檔案的結構
包含 VSIX 套件中內容類型的相關信息。 Visual Studio 會使用 [Content_Types].xml 檔案來安裝套件,但不會安裝檔案本身。
注意
雖然本主題僅適用於 VSIX 套件中使用的 [Content_Type].xml 檔案,但 [Content_Types].xml 檔案類型是開放式封裝慣例 (OPC) 標準的一部分。 如需詳細資訊,請參閱 OPC:MSDN 網站上的數據 封裝新標準。
屬性和項目
下列各節說明根元素及其屬性和子元素。
根項目
元素 | 描述 |
---|---|
Types |
包含列舉 VSIX 套件中檔類型的子專案。 |
屬性
屬性 | 描述 |
---|---|
Xmlns |
(必要。)用於這個 [Content_Types].xml 檔案的架構位置。 |
{屬性名稱}屬性
值 | Description |
---|---|
http://schemas.openformats.org/package/2006/content-types |
內容類型架構的位置。 |
子元素
元素 Types
可以包含任意數目的專案 Default
。
元素 | 描述 |
---|---|
Default |
描述 VSIX 套件中的內容類型。 封裝中的每個檔類型都必須有自己的 Default 元素。 |
屬性
屬性 | 描述 |
---|---|
Extension |
VSIX 套件中檔案的擴展名。 |
ContentType |
描述與擴展名相關聯的內容種類。 |
{屬性名稱}屬性
Visual Studio 會辨識相關聯Extension
類型的下列ContentType
值。
副檔名 | ContentType |
---|---|
TXT | text/plain |
pkgdef | text/plain |
xml | text/xml |
vsixmanifest | text/xml |
htm 或 html | text/html |
Rtf | application/rtf |
應用程式/pdf | |
GIF | image/gif |
jpg 或 jpeg | image/jpg |
tiff | image/tiff |
vsix | application/zip |
zip | application/zip |
dll | application/octet-stream |
所有其他文件類型 | application/octet-stream |
範例
描述
下列 [Content_Types].xml 檔案描述典型的 VSIX 套件。
程式碼
<?xml version="1.0" encoding="utf-8" ?>
<Types xmlns="http://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>