Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Query-Package

Tests whether a universal package exists and optionally extracts its metadata.

Script usage:

UPack::Query-Package(
	[From: <text>],
	Name: <text>,
	Version: <text>,
	NewVersion: <text>,
	[Reason: <text>],
	[PackageFile: <text>],
	[Feed: <text>],
	[EndpointUrl: <text>],
	[UserName: <text>],
	[Password: <text>],
	[ApiKey: <text>],
	[Exists: <true/false>],
	[Metadata: <%(key1: value1, ...)>],
	[FeedUrl: <text>]
);

Arguments:

NameFormatScript UsageUsage Notes
Package source
text
From
Package name
text
Name
This argument is required.
Package version
text
Version
This argument is required.
New version
text
NewVersion
This argument is required.
Reason
text
Reason
Package file
text
PackageFile
When specified, FeedUrl, UserName, Password, PackageName, and PackageVersion are ignored.
Feed name
text
Feed
API endpoint URL
text
EndpointUrl
ProGet user name
text
UserName
The name of a user in ProGet that can access this feed.
ProGet password
text
Password
The password of a user in ProGet that can access this feed.
ProGet API Key
text
ApiKey
An API Key that can access this feed.
Package exists
true/false
Exists
When specified, this string variable will be set to "true" if the package exists or "false" if it does not.
Package metadata
%(key1: value1, ...)
Metadata
When specified, this map variable will be assigned containing all of the package's metadata. If the package does not exist this value is not defined.
FeedUrl
text
FeedUrl

Example:


# test whether a package exists in a feed and capture its metadata
Query-Package
(
    Credentials: MyExternalFeed,
    PackageName: Group/Package,
    Exists => $exists,
    Metadata => %packageData
);

if $exists
{
    Log-Debug 'Package $(%packageData.name) exists. Latest version is $(%packageData.version).';
}



# extract metadata from a locally-stored package file
Query-Package
(
    PackageFile: C:\MyPackages\Package-1.0.0.upack,
    Metadata => %packageData
);

Log-Debug 'Package name is $(%packageData.name).';