Share via


PackageDependency.CreateForSystem Method

Definition

Creates an install-time reference for a framework package dependency for the current app, using the specified package family name and minimum version and the specified options. This method creates a framework package dependency that is accessible to all users, and this method requires that the caller has administrative privileges. To create a framework package dependency that is accessible only to the current user, use the Create method instead.

public:
 static PackageDependency ^ CreateForSystem(Platform::String ^ packageFamilyName, PackageVersion minVersion, CreatePackageDependencyOptions ^ options);
 static PackageDependency CreateForSystem(winrt::hstring const& packageFamilyName, PackageVersion const& minVersion, CreatePackageDependencyOptions const& options);
public static PackageDependency CreateForSystem(string packageFamilyName, PackageVersion minVersion, CreatePackageDependencyOptions options);
function createForSystem(packageFamilyName, minVersion, options)
Public Shared Function CreateForSystem (packageFamilyName As String, minVersion As PackageVersion, options As CreatePackageDependencyOptions) As PackageDependency

Parameters

packageFamilyName
String

Platform::String

winrt::hstring

The package family name of the framework package on which to take dependency.

minVersion
PackageVersion

The minimum version of the framework package on which to take dependency.

options
CreatePackageDependencyOptions

Defines additional criteria to specify the framework package you want to use in your app.

Returns

The object that represents the package dependency, and provides members you can use to manage the lifetime of the dependency.

Remarks

In your app's installer or during the first run of your app, call this method to specify a set of criteria for a framework package you want to use in your app. This informs the OS that your app has a dependency upon a framework package that meets the specified criteria. If one or more framework packages are installed that meet the criteria, Windows will ensure that at least one of these framework packages will remain installed until the install-time reference is deleted. For more information, see Use the dynamic dependency API to reference MSIX packages at run time.

This function fails if the specified dependency criteria cannot be resolved to a specific package. This package resolution check can be skipped by using the VerifyDependencyResolution is specified for the options parameter. This is useful for installers running as user contexts other than the target user (for example, installers running as LocalSystem).

Applies to

See also