com4:Extension
提供向应用包外部的客户端公开 COM 注册的功能。 com4 扩展是新版本,它是以前的 COM 架构版本的超集和替代。 有关详细信息,请参阅备注部分。
元素层次结构
<com4:Extension>
语法
<com4:Extension
Category = 'A string that can have one of the following values: "windows.comServer" or "windows.comInterface".'
Executable = 'An optional string with a value between 1 and 256 characters in length that must end with ".exe" and cannot contain these characters: <, >, :, ", |, ?, or *.'
EntryPoint = 'An optional string with a value between 1 and 256 characters in length that cannot start or end with a whitespace character.'
RuntimeType = 'An optional string with a value between 1 and 255 characters in length that cannot start or end with a period or contain these characters: <, >, :, ", /, \, |, ?, or *.'
StartPage = 'An optional string with a value between 1 and 256 characters in length that cannot contain these characters: <, >, :, ", |, ?, or *.'
ResourceGroup = 'An optional alphanumeric string with a value between 1 and 255 characters in length. Must begin with a letter.'
TrustLevel = 'An optional string the can have one of the following values: "appContainer" or "mediumIL".'
RuntimeBehavior = 'An optional string the can have one of the following values: "windowsApp", "packagedClassicApp", or "win32App".'
HostId = 'An optional alphanumeric string with a value between 1 and 255 characters in length. Must begin with a letter.'
Parameters = 'An optional string with a value between 1 and 32767 characters in length with a non-whitespace character at its beginning and end.'
uap11:Id = 'An optional string with a value between 1 and 255 characters in length with a non-whitespace character at its beginning and end.'
uap11:Subsystem = 'An optional string that can have one of the following values: "console" or "windows".'
uap11:SupportsMultipleInstances = 'An optional boolean value.'
uap11:ResourceGroup = 'An optional alphanumeric string with a value between 1 and 255 characters in length. Must begin with a letter.'
uap11:CurrentDirectoryPath = 'An optional string that cannot contain these characters: <, >, |, ?, or *. >'
uap11:Parameters = 'An optional string with a value between 1 and 32767 characters in length with a non-whitespace character at its beginning and end.'
desktop7:CompatMode = 'An optional string the can have one of the following values: "classic" or "modern".'
desktop7:Scope = 'An optional string that can have one of the following values: "machine" or "user".' />
<!-- Child elements -->
com4:ComServer
com4:ComInterface
</com4:Extension>
特性和元素
属性
属性 | 说明 | 数据类型 | 必须 | 默认值 |
---|---|---|---|---|
类别 | 应用扩展点的类型。 | 可以具有以下值之一的字符串: windows.comServer 或 windows.comInterface。 | 是 | |
可执行文件 | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 | 值长度介于 1 到 256 个字符之间的可选字符串,必须以 .exe 结尾,并且不能包含以下字符:< 、> 、: 、" 、| ? 、 或 * 。 |
否 | |
EntryPoint | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 | 一个可选字符串,其值长度介于 1 到 256 个字符之间,不能以空格字符开头或结尾。 | 否 | |
RuntimeType | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 | 值长度介于 1 到 255 个字符之间的可选字符串,不能以句点开头或结尾,也不能包含以下字符:< 、、> 、: 、\ / | " ? 、 或 。* |
否 | |
StartPage | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 | 值长度介于 1 到 256 个字符之间的可选字符串,不能包含以下字符:< 、、: > 、" 、| ? 、 或 * 。 |
否 | |
ResourceGroup | 一个标记,可用于将扩展激活组合在一起以进行资源管理, (例如 CPU 和内存) 。 可以设置的 ResourceGroup 值是自由格式且灵活的。 请参阅 Application@ResourceGroup。 | 值长度介于 1 到 255 个字符之间的可选字母数字字符串。 必须以字母开头。 | 否 | |
uap10:TrustLevel | 指定扩展的信任级别。 在当前版本中,com4 扩展不支持此属性。 始终使用值“mediumIL”。 | 可选字符串 可以具有以下值之一: appContainer 或 mediumIL。 | 否 | |
uap10:RuntimeBehavior | 指定扩展的运行时行为。 在当前版本中,com4 扩展不支持此属性。 始终使用值“packagedClassicApp”。 | 可选字符串 可以具有以下值之一: windowsApp、 packagedClassicApp 或 win32App。 | 否 | |
uap10:HostId | 此值指定扩展的主机运行时的 ID。 | 值长度介于 1 到 255 个字符之间的可选字母数字字符串。 必须以字母开头。 | 否 | |
uap10:Parameters | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 | 一个可选字符串,其值长度介于 1 到 32767 个字符之间,开头和结尾处有一个非空格字符。 | 否 | |
uap11:Id | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 | 值长度介于 1 到 255 个字符之间的可选字符串,开头和结尾处有一个非空格字符。 | 否 | |
uap11:Subsystem | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 | 可具有以下值之一的可选字符串: console 或 windows。 | 否 | |
uap11:SupportsMultipleInstances | 指定实例是否应在不同的进程中运行。 默认值为 false。 | 可选的布尔值。 | 否 | |
uap11:ResourceGroup | 一个标记,可用于将扩展激活组合在一起以进行资源管理, (例如 CPU 和内存) 。 可以设置的 ResourceGroup 值是自由格式且灵活的。 请参阅 Application@ResourceGroup。 | 值长度介于 1 到 255 个字符之间的可选字母数字字符串。 必须以字母开头。 | 否 | |
uap11:CurrentDirectoryPath | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 此属性支持宏。 有关详细信息,请参阅 包清单架构中的宏。 | 不能包含以下字符的可选字符串: < 、 > 、 | 、 ? 或 * 。 > |
否 | |
uap11:Parameters | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除语法验证外,此值将被忽略。 此属性支持宏。 有关详细信息,请参阅 包清单架构中的宏。 | 一个可选字符串,其值长度介于 1 到 32767 个字符之间,开头和结尾处有一个非空格字符。 | 否 | |
desktop7:CompatMode | 指定此扩展的信息是通过经典方式向 Windows 注册的, (例如,未打包的应用通过注册表) 或通过新的范围更广的方式向 COM 注册类型。 默认值为“modern”。 CompatMode=“classic”需要 Microsoft.classicAppCompat_8wekyb3d8bbwe 功能。 | 可选字符串 可以具有以下值之一: classic 或 modern。 | 否 | |
desktop7:Scope | 指定注册是否仅对以用户 (用户) 注册此包的用户运行的其他应用程序可见,或者是否对计算机上的所有用户和服务可见 (计算机) 。 默认值为“user”。 Scope=“machine”需要 Microsoft.classicAppCompatElevated_8wekyb3d8bbwe 功能。 | 可具有以下值之一的可选字符串: machine 或 user。 | 否 |
子元素
子元素 | 描述 |
---|---|
com4:ComServer | comServer 扩展可能包括类注册,包括实现这些类的服务器激活详细信息,以及 ProgId 和 TreatAsClass 注册,它们提供用于在运行时引用这些类的其他标识符。 |
com4:ComInterface | 声明 类型为 windows.comInterface 的包扩展点 (com4:ComInterface) 。 |
父元素
子元素 | 说明 |
---|---|
扩展 | 定义应用的一个或多个扩展点。 |
注解
com4 扩展实质上是旧 windows.comServer/windows.comInterface 扩展语法的重写。 此扩展是以前的 com 扩展功能的超集,其行为与继承的语法相同。 打包中使用的新语法的清单验证更符合扩展的语义要求。
- 在以前的版本中,每个扩展都被视为一个单独的文档,允许验证非唯一键和悬空引用。
- 在以前的版本中,仅当重复的属性出现在扩展的同一实例中时,清单验证才会捕获受唯一/键约束的属性的重复。 复制这些属性的包将无法部署,诊断信息有限,无法识别问题。
- 在以前的版本中,引用位于扩展的不同实例中的密钥引用将被清单验证阻止,这是相对于部署/运行时行为支持的人为限制。
面向Windows 11的应用程序应使用它的所有 windows.comServer/windows.comInterface 扩展的新 com4 命名空间。 不建议将新命名空间与旧命名空间混合,原因包括:
- 在支持新命名空间的版本上部署包将处理来自所有命名空间的扩展,使用不同命名空间版本的扩展之间复制的任何唯一标识符都将导致失败。 使用较旧的命名空间可防止清单验证检测这些错误。
- 由于旧命名空间架构的限制,旧语法中的 keyref 不能引用新语法中的键,因为它们位于扩展的不同实例中。
使用以下 com4 语法语义具有功能要求:
- CompatMode=“classic”需要Microsoft.classicAppCompat_8wekyb3d8bbwe
- Scope=“machine”需要Microsoft.classicAppCompatElevated_8wekyb3d8bbwe
以下示例演示如何为同一类注册进程外和进程内服务器实现。
示例
<com4:Class Id="f4ed7720-9b3a-44a4-xxxx-xxxxxxxxxxxx" DisplayName="CLSID_Foo"/>
<com:ExeServer Executable="MyServer.exe" DisplayName="My server">
<com4:ClassReference Id="f4ed7720-9b3a-44a4-xxxx-xxxxxxxxxxxx"/>
</com:ExeServer>
<com4:InProcessServer Path="MyServer.dll">
<com4:ClassReference Id="f4ed7720-9b3a-44a4-xxxx-xxxxxxxxxxxx"/>
</com4:InProcessServer>
com4 扩展中的新功能
- 支持进程内服务器 (非托管和托管) 以及自定义进程内处理程序 (,即,而不是 OLE 默认处理程序) 。 此功能目前受策略限制和功能限制:
- 这目前仅供具有外部位置的包使用;它不适用于大多数普通包,因为安装位置上的 ACL 阻止包的 dll 加载到包外部。 有关具有外部位置的包的详细信息,请参阅 使用外部位置打包授予包标识。
- 现在可以将 TypeLib 与类注册相关联。
要求
项 | 值 |
---|---|
Namespace | http://schemas.microsoft.com/appx/manifest/com/windows10/4 |
Minimum OS Version | Windows 10 (内部版本 20348) |
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈