com4:Extension
提供向应用包外部客户端公开 COM 注册的功能。 com4 扩展是以前 COM 架构版本的超集和替换的新版本。 有关详细信息,请参阅“备注”部分。
元素层次结构
<com4:Extension>
<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 扩展。 除了语法验证之外,此值将被忽略。 | 一个可选字符串,可以具有以下值之一:控制台 或 窗口。 | 不 | |
uap11:SupportsMultipleInstances | 指定实例是否应在不同的进程中运行。 默认值为 false。 | 可选的布尔值。 | 不 | |
uap11:ResourceGroup | 一个标记,可用于将扩展激活组合在一起以进行资源管理(例如 CPU 和内存)。 可以设置 ResourceGroup 的值是自由格式且灵活的。 请参阅 Application@ResourceGroup。 | 一个可选的字母数字字符串,其长度介于 1 到 255 个字符之间。 必须以字母开头。 | 不 | |
uap11:CurrentDirectoryPath | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除了语法验证之外,此值将被忽略。 此属性支持宏。 有关详细信息,请参阅包清单架构中的 |
不能包含以下字符的可选字符串:< 、> 、| 、? 或 * 。 > |
不 | |
uap11:Parameters | 此属性继承自基本扩展语法,不适用于 com4 扩展。 除了语法验证之外,此值将被忽略。 此属性支持宏。 有关详细信息,请参阅包清单架构中的 |
一个可选字符串,其长度在 1 到 32767 个字符之间,其开头和结尾有非空格字符。 | 不 | |
desktop7:CompatMode | 指定此扩展的信息是以经典方式(例如,通过注册表向 COM 注册类型)还是以新的更作用域的方式向 Windows 注册。 默认值为“modern”。 CompatMode=“classic”需要 Microsoft.classicAppCompat_8wekyb3d8bbwe 功能。 | 可选字符串,可以具有以下值之一:经典 或 新式。 | 不 | |
desktop7:范围 | 指定注册是否仅对作为已注册此包的用户运行的其他应用程序可见,或者是否对计算机上的所有用户和服务可见。 默认值为“user”。 Scope=“machine”需要 Microsoft.classicAppCompatElevated_8wekyb3d8bbwe 功能。 | 一个可选字符串,可以具有以下值之一:计算机 或 用户。 | 不 |
子元素
子元素 | 描述 |
---|---|
com4:ComServer | comServer 扩展可能包括类注册,包括实现这些类的服务器的激活详细信息,以及 ProgId 和 TreatAsClass 注册,这些注册提供用于在运行时引用这些类的其他标识符。 |
com4:ComInterface | 声明 windows.comInterface(com4:ComInterface)类型的包扩展点。 |
父元素
子元素 | 描述 |
---|---|
扩展 | 定义应用的一个或多个扩展点。 |
言论
com4 扩展本质上是旧 windows.comServer/windows.comInterface 扩展语法的重写。 此扩展是上一个 com 扩展功能的超集,具有继承语法的相同行为。 打包中使用的新语法的清单验证更符合扩展的语义要求。
- 在以前的版本中,每个扩展都被视为单独的文档,允许验证非唯一键和悬停引用。
- 在以前的版本中,仅当重复的属性出现在扩展的同一实例中时,才会通过清单验证捕获受唯一/键约束约束的属性。 复制这些属性的包将无法部署,诊断信息有限,无法识别问题。
- 在以前的版本中,引用位于扩展的其他实例中的 keyref 会被清单验证阻止,这是相对于部署/运行时行为支持的人为限制。
面向 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 |
最低 OS 版本 | Windows 10 (内部版本 20348) |