---
title: "Ensure-Package"
---
Ensures that the specified universal package is installed in the specified directory.
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>],
[FeedUrl: <text>]
);
| Name | Format | Script Usage | Usage Notes |
|---|---|---|---|
| Package source | text | PackageSource | |
| ☆ Package name | text | Name | This argument is required. |
| Package version | text | Version | Default value is "latest". |
| Target directory | text | To | The directory path on disk of the package contents. Default value is "$WorkingDirectory". |
| Exists | true/false | Exists | Default value is "True". |
| Use Local Registry | integer | LocalRegistry | Default value is "Machine". |
| LocalCache | true/false | LocalCache | Cache Package. Default value is "False". |
| Compare files | integer | FileCompare | Default value is "FileSize". |
| Ignore | @(text) | Ignore | See KB#1119 to learn more about masking syntax. Value note: "compare all files". |
| Direct download | true/false | DirectDownload | Set this to value to false if your remote server doesn't have direct access to the ProGet feed. Default value is "True". |
| Feed name | text | Feed | Not specifying will "Use Feed from package source". |
| API endpoint URL | text | EndpointUrl | Not specifying will "Use URL from package source". |
| ProGet user name | text | UserName | The name of a user in ProGet that can access this feed. Not specifying will "Use user name from package source". |
| ProGet password | text | Password | The password of a user in ProGet that can access this feed. Not specifying will "Use password from package source". |
| ProGet API Key | text | ApiKey | An API Key that can access this feed. Not specifying will "Use API Key from package source". |
| 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.
#Ensure that FooBarApp is Installed
ProGet::Ensure-Package
(
From: MyPackageSource,
Name: FooBarApp,
Version: $FooBarVersion,
To: D:\WebApps\FooBar.App,
Ignore: web.config
);