PackageDependency.Add Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Add() |
Adds a run-time reference for the framework package dependency you created earlier by using the Create method. After this method successfully returns, your app may activate types and use content from the framework package. |
Add(AddPackageDependencyOptions) |
Adds a run-time reference for the framework package dependency you created earlier by using the Create method, with the specified options. After this method successfully returns, your app can activate types and use content from the framework package. |
Add()
public:
virtual PackageDependencyContext ^ Add() = Add;
/// [Windows.Foundation.Metadata.Overload("Add")]
PackageDependencyContext Add();
[Windows.Foundation.Metadata.Overload("Add")]
public PackageDependencyContext Add();
function add()
Public Function Add () As PackageDependencyContext
Returns
An object that provides context info about the framework package dependency and enables you to remove the run-time reference.
- Attributes
Remarks
Calling this method resolves the framework package dependency to a specific package on the system. It also informs the OS that the framework package is in active use and to handle any version updates in a side-by-side manner (effectively delay uninstalling or otherwise servicing the older version until after your app is done using it). Package resolution is specific to a user and can return different values for different users on a system.
Each successful Add call adds the resolved package to the calling process' package graph, even if already present. There is no duplicate detection or filtering applied by the API (that is, multiple references from a package is not harmful). After resolution is complete, the package dependency stays resolved for that user until the last reference across all processes for that user is removed via PackageDependencyContext.Remove or the process is terminated. Successful calls to this method change the PackageDependency.GenerationId value.
After this method successfully returns, your app can activate types and use content from the framework package until PackageDependencyContext.Remove is called.
If multiple packages are present in the package graph with the same rank as the call to Add, the resolved package is added after others of the same rank.
For more information, see Use the dynamic dependency API to reference MSIX packages at run time.
See also
Applies to
Add(AddPackageDependencyOptions)
public:
virtual PackageDependencyContext ^ Add(AddPackageDependencyOptions ^ options) = Add;
/// [Windows.Foundation.Metadata.Overload("Add2")]
PackageDependencyContext Add(AddPackageDependencyOptions const& options);
[Windows.Foundation.Metadata.Overload("Add2")]
public PackageDependencyContext Add(AddPackageDependencyOptions options);
function add(options)
Public Function Add (options As AddPackageDependencyOptions) As PackageDependencyContext
Parameters
- options
- AddPackageDependencyOptions
Defines additional options to specify the framework package reference.
Returns
An object that provides context info about the framework package dependency and enables you to remove the run-time reference.
- Attributes
Remarks
Calling this method resolves the framework package dependency to a specific package on the system. It also informs the OS that the framework package is in active use and to handle any version updates in a side-by-side manner (effectively delay uninstalling or otherwise servicing the older version until after your app is done using it). Package resolution is specific to a user and can return different values for different users on a system.
Each successful Add call adds the resolved package to the calling process' package graph, even if already present. There is no duplicate detection or filtering applied by the API (that is, multiple references from a package is not harmful). After resolution is complete, the package dependency stays resolved for that user until the last reference across all processes for that user is removed via PackageDependencyContext.Remove or the process is terminated. Successful calls to this method change the PackageDependency.GenerationId value.
After this method successfully returns, your app can activate types and use content from the framework package until PackageDependencyContext.Remove is called.
If multiple packages are present in the package graph with the same rank as the call to Add, the resolved package is (by default) added after others of the same rank. To add a package before others of the same rank, specify PrependIfRankCollision for the options parameter.
For more information, see Use the dynamic dependency API to reference MSIX packages at run time.