Aracılığıyla paylaş


PackageVersion Struct

Definition

Represents the package version info.

public value class PackageVersion
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
struct PackageVersion
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public struct PackageVersion
var packageVersion = {
major : /* Your value */,
minor : /* Your value */,
build : /* Your value */,
revision : /* Your value */
}
Public Structure PackageVersion
Inheritance
PackageVersion
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

Use the Package.Current property to get the package for the current app. Use the Package.Id property to get the package ID, from which you can then get the version.

var package = Windows.ApplicationModel.Package.current;
var packageId = package.id;
var version = packageId.version;
using Windows.ApplicationModel;

Package package = Package.Current;
PackageId packageId = package.Id;
PackageVersion version = packageId.Version;
Dim package As Windows.ApplicationModel.Package = Windows.ApplicationModel.Package.Current
Dim packageId As Windows.ApplicationModel.PackageId = package.Id
Dim version As Windows.ApplicationModel.PackageVersion = packageId.Version
Windows::ApplicationModel::Package package{ Windows::ApplicationModel::Package::Current() };
Windows::ApplicationModel::PackageId packageId{ package.Id() };
Windows::ApplicationModel::PackageVersion version{ packageId.Version() };
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::ApplicationModel::PackageId^ packageId = package->Id;
Windows::ApplicationModel::PackageVersion version = packageId->Version;

Fields

Build

The build version number of the package.

Major

The major version number of the package.

Minor

The minor version number of the package.

Revision

The revision version number of the package.

Applies to

See also