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.

Ensure-Package

Ensures that the specified universal package is installed in the specified directory.

Script usage:

ProGet::Ensure-Package(
	[PackageSource: <text>],
	Name: <text>,
	[Version: <text>],
	[To: <text>],
	[Exists: <true/false>],
	[LocalRegistry: <integer>],
	[LocalCache: <true/false>],
	[FileCompare: <integer>],
	[Ignore: <@(text)>],
	[DirectDownload: <true/false>],
	[Feed: <text>],
	[EndpointUrl: <text>],
	[UserName: <text>],
	[Password: <text>],
	[ApiKey: <text>],
	[DeleteExtra: <true/false>],
	[Include: <@(text)>],
	[Exclude: <@(text)>],
	[FeedUrl: <text>]
);

Arguments:

NameFormatScript UsageUsage Notes
Package source
text
PackageSource
Package name
text
Name
This argument is required.
Package version
text
Version
Target directory
text
To
The directory path on disk of the package contents.
Exists
true/false
Exists
Use Local Registry
integer
LocalRegistry
LocalCache
true/false
LocalCache
Cache Package
Compare files
integer
FileCompare
Ignore
@(text)
Ignore
See KB#1119 to learn more about masking syntax.
Direct download
true/false
DirectDownload
Set this to value to false if your remote server doesn't have direct access to the ProGet feed.
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.
DeleteExtra
true/false
DeleteExtra
Include
@(text)
Include
Exclude
@(text)
Exclude
FeedUrl
text
FeedUrl

Note: To determine if a package is installed, the local package registry and package files are both checked. You can control these with LocalRegistry and FileCompare options.

Example:

#Ensure that FooBarApp is Installed
ProGet::Ensure-Package
(
    From: MyPackageSource,
    Name: FooBarApp,
    Version: $FooBarVersion,
    To: D:\WebApps\FooBar.App,
    Ignore: web.config
);