AddPackageDependency2 function (appmodel.h)
Adds a run-time reference for the framework package dependency you created earlier by using the TryCreatePackageDependency method, with the specified options. After this method successfully returns, your app can activate types and use content from the framework package.
Syntax
HRESULT AddPackageDependency2(
PCWSTR packageDependencyId,
INT32 rank,
AddPackageDependencyOptions2 options,
PACKAGEDEPENDENCY_CONTEXT *packageDependencyContext,
PWSTR *packageFullName
);
Parameters
packageDependencyId
Type: PCWSTR
The ID of the package dependency to be resolved and added to the invoking process' package graph. This parameter must match a package dependency defined by using the TryCreatePackageDependency function for the calling user or the system (via the CreatePackageDependencyOptions_ScopeIsSystem option), or else an error is returned.
rank
Type: INT32
The rank to use to add the resolved package to the caller's package graph. For more information, see Remarks.
options
Type: AddPackageDependencyOptions2
The options to apply when adding the package dependency.
packageDependencyContext
Type: PACKAGEDEPENDENCY_CONTEXT*
The handle of the added package dependency. This handle is valid until it is passed to RemovePackageDependency.
packageFullName
Type: PCWSTR*
When this method returns, contains the address of a pointer to a null-terminated Unicode string that specifies the full name of the package to which the dependency has been resolved. The caller is responsible for freeing this resource once it is no longer needed by calling HeapFree.
Return value
Type: HRESULT
If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error codes include the following.
Return code | Description |
---|---|
E_INVALIDARG | The packageDependencyId or packageDependencyContext parameter is NULL on input. |
Remarks
See Remarks for AddPackageDependency.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 11, version 23H2 (10.0; Build 22631) |
Header | appmodel.h |