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

# MicrosoftGame.config Element - FileTypeAssociation

> MicrosoftGame.config Element - FileTypeAssociation

# MicrosoftGame.config Element - FileTypeAssociation

允许将文件类型与包中的可执行文件关联。例如，标题地图编辑器的特定扩展名。

## 父元素

此元素的父元素是 DesktopRegistration 元素。

## 要求

此元素为可选，无需设置。

## 平台

此元素仅适用于 PC 设备。

## 行为

* 属性为 Name 和 Executable。
* Name 属性没有默认值。
* Executable 属性将默认为标题的 ExecutableList 元素中的第一个可执行文件。
* Name 属性的允许值为最多 100 个小写字符（不含空格）的字符串。
* Executable 属性的允许值为一个可执行文件名，应与 Executable 元素中的 Name 匹配。
* 允许值为以下子元素：
  * DisplayName
  * Logo
  * InfoTip
  * EditFlags
  * SupportedFileTypes

## 备注

### FileTypeAssociation 示例

FileTypeAssociation 是 DesktopRegistration 节点的子元素。它可用于启用 PC 上与可执行文件关联的附加文件的使用。其主要用例是自定义 mod 或地图。请参阅以下此实现的示例作为参考：

```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 参考 - 目录](/reference/system/microsoftgameconfig/elements/gc-microsoftgameconfig-toc)


## Related topics

- [MicrosoftGame.config Element - Logo](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-logo.md)
- [MicrosoftGame.config Element - DisplayName](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-displayname.md)
- [MicrosoftGame.config Element - EditFlags](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-editflags.md)
- [MicrosoftGame.config Element - InfoTip](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-infotip.md)
- [MicrosoftGame.config Element - DesktopRegistration](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-desktopregistration.md)
