> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FileTypeAssociation 元素 (MicrosoftGame.config)

> MicrosoftGame.config 元素 - FileTypeAssociation

# MicrosoftGame.config 元素 - FileTypeAssociation

允許將檔案類型與您套件中的可執行檔建立關聯。例如，遊戲地圖編輯器的特定副檔名。

## 父系

此元素的父系是 DesktopRegistration 元素。

## 需求

此元素為選用，不需要設定。

## 平台

此元素僅適用於 PC 裝置。

## 行為

* 屬性為 Name 和 Executable。
* Name 屬性沒有預設值。
* Executable 屬性預設為您遊戲 ExecutableList 元素中的第一個可執行檔。
* Name 屬性允許的值為最多 100 個小寫字元且不含空格的字串。
* Executable 屬性允許的值為可執行檔名稱，應與您 Executable 元素中的 Name 相符。
* 允許的值為下列子元素：
  * DisplayName
  * Logo
  * InfoTip
  * EditFlags
  * SupportedFileTypes

## 備註

### FileTypeAssociation 範例

FileTypeAssociation 是 DesktopRegistration 節點的子元素。它可用來在 PC 上啟用與可執行檔相關聯的其他檔案。主要使用案例為自訂模組或地圖。請參考下列實作範例：

```xml theme={null}
<FileTypeAssociation Name="MyModExtension">
  <DisplayName>ExampleFriendlyName</DisplayName>
  <EditFlags OpenIsSafe="true" AlwaysUnsafe="false">
  <InfoTip>ExampleInfo</InfoTip>
  <Logo>ExampleLogo.png</Logo>
  <SupportedFileTypes>
    <FileType>.mod</FileType>
  </SupportedFileTypes>
  <Executable>MyGame.exe</Executable>
</FileTypeAssociation>
```

## 另請參閱

[MicrosoftGame.config 參考 - 目錄](https://docs.xbox.com/zh-TW/reference/system/microsoftgameconfig/elements/gc-microsoftgameconfig-toc.md)


## Related topics

- [MicrosoftGame.config 元素參考 (內容)](https://docs.xbox.com/zh-TW/reference/system/microsoftgameconfig/elements/gc-microsoftgameconfig-toc.md)
- [SupportedFileTypes 元素 (MicrosoftGame.config)](https://docs.xbox.com/zh-TW/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-supportedfiletypes.md)
- [Logo 元素 (MicrosoftGame.config)](https://docs.xbox.com/zh-TW/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-logo.md)
- [DisplayName 元素 (MicrosoftGame.config)](https://docs.xbox.com/zh-TW/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-displayname.md)
- [EditFlags 元素 (MicrosoftGame.config)](https://docs.xbox.com/zh-TW/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-editflags.md)
