PackageVersion 结构

定义

表示包版本信息。

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
继承
PackageVersion
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

使用 Package.Current 属性获取当前应用的包。 使用 Package.Id 属性获取包 ID,然后可以从中获取版本。

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;

字段

Build

包的内部版本号。

Major

包的主版本号。

Minor

包的次要版本号。

Revision

包的修订版本号。

适用于

另请参阅