Package.IsOptional Package.IsOptional Package.IsOptional Package.IsOptional Package.IsOptional Property


Indicates whether the package is optional.

public : Platform::Boolean IsOptional { get; }
bool IsOptional();
public bool IsOptional { get; }
Public ReadOnly Property IsOptional As bool
var bool = package.isOptional;

Property Value

bool bool bool

Returns true if the package is optional; false otherwise.

Additional features and requirements

Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)


// Get the main app package
Package currentPackage = Package.Current;

// Get a list of dependencies for the main package. This includes all resource packages, framework packages, and optional packages.
IReadOnlyList<Package> dependencies = currentPackage.Dependencies;

foreach (Package package in dependencies.Where(_ => _.IsOptional))
    // Iterate through a list of the optional packages


Optional packages are dependent on another package that must be installed first. For example a map application may have optional geographic area packages.