Compress-PSResource
Compresses a specified folder containing module or script resources into a .nupkg file.
Syntax
Default (Default)
Compress-PSResource
[-Path] <String>
[-DestinationPath] <String>
[-PassThru]
[-SkipModuleManifestValidate]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
This cmdlet compresses a specified folder containing module or script resources into a .nupkg
file. isolates the pack feature in the Publish-PSResource cmdlet. This allows you to sign the
.nupkg file before publishing it to a repository. You can publish the final .nupkg file using
the NupkgPath parameter of Publish-PSResource.
This command was added in v1.1.0-preview2 of Microsoft.PowerShell.PSResourceGet.
Examples
Example 1
This example compresses the module TestModule and saves te nupkg to the DestinationPath.
Compress-PSResource -Path C:\TestModule -DestinationPath C:\NupkgDestination
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-DestinationPath
Path to save the compressed resource.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 1 |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-PassThru
Pass the full path of the nupkg through the pipeline.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Path
Path to the resource to be compressed.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-SkipModuleManifestValidate
Skips validating the module manifest before creating the .nupkg file.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet isn't run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
None
Outputs
FileInfo
By default, this command doesn't write any output to the pipeline. When you use the PassThru
parameter, it returns a FileInfo object for the new .nupkg file.
Notes
The module defines cmres as an alias for Compress-PSResource.
This cmdlet allows for publishing nuspec dependencies into ACR.