Udostępnij za pośrednictwem


Publish-PSResource

Publishes a specified module from the local computer to PSResource repository.

Składnia

PathParameterSet

Publish-PSResource
    [-Path] <String>
    [-ApiKey <String>]
    [-Repository <String>]
    [-DestinationPath <String>]
    [-Credential <PSCredential>]
    [-SkipDependenciesCheck]
    [-SkipModuleManifestValidate]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

NupkgPathParameterSet

Publish-PSResource
    -NupkgPath <String>
    [-ApiKey <String>]
    [-Repository <String>]
    [-DestinationPath <String>]
    [-Credential <PSCredential>]
    [-SkipDependenciesCheck]
    [-SkipModuleManifestValidate]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Opis

This cmdlet combines the functions of the Publish-Module and Publish-Script cmdlets from PowerShellGet v2. Publish-PSResource publishes a resource from the local computer to an online NuGet-based repository. You can specify the resource by a path containing the module or script resource files or by pointing a prepackaged .nupkg file.

Przykłady

Example 1

This example publishes the module TestModule to the repository registered with highest priority.

Publish-PSResource -Path c:\TestModule

Example 2

This example publishes the module TestModule to the PowerShell Gallery. The API key is a secret that's generated by the PowerShell Gallery for a user account.

Publish-PSResource -Path c:\TestModule -Repository PSGallery -APIKey '1234567'

Example 3

This example publishes the module Nupkg TestModule.nupkg to a repository named TestRepository.

Publish-PSResource -NupkgPath c:\TestModule.nupkg -Repository TestRepository

Parametry

-ApiKey

Specifies the API key that you want to use to publish a resource to the online gallery.

Właściwości parametru

Typ:String
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Właściwości parametru

Typ:SwitchParameter
Domyślna wartość:False
Obsługuje symbole wieloznaczne:False
DontShow:False
Aliasy:cf

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-Credential

Specifies a user account that has rights to a specific repository.

Właściwości parametru

Typ:PSCredential
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-DestinationPath

Specifies the path where the NuGet package .nupkg file should be saved. This parameter can be used in conjunction with the Repository parameter to publish to a repository and also save the exact same package to the local file system.

Właściwości parametru

Typ:String
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-ModulePrefix

This is a dynamic parameter that's only available on the command line when you have supplied the Path or Nupkg parameters and the Repository parameter for a ContainerRegistry repository.

The value of the parameter is pre-pended to the package name. This information is only used for publishing and isn't included in the package metadata. The module prefix controls the visibility of the module, for example: internal, public, staging.

This parameter is only used when publishing to the Microsoft Artifact Registry (MAR).

Właściwości parametru

Typ:String
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

All
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-NupkgPath

Path to the .nupkg file to be published. The .nupkg file could have been created by a previous run of Publish-PSResource with the DestinationPath parameter. Or, you can create the .nupkg file using the Compress-PSResource command.

This parameter was added in v1.1.0-preview2 of Microsoft.PowerShell.PSResourceGet.

Właściwości parametru

Typ:String
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

NupkgPathParameterSet
Position:Named
Obowiązkowy:True
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-Path

The path to the module or script file or the path to a folder containing the module or script file to be published. The cmdlet packages all files in the folder into a .nupkg file before publishing to the repository.

Właściwości parametru

Typ:String
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

PathParameterSet
Position:0
Obowiązkowy:True
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-Proxy

The URL to a proxy server used to access repositories outside of your network.

Właściwości parametru

Typ:Uri
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-ProxyCredential

The credentials required to use the proxy server.

Właściwości parametru

Typ:PSCredential
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-Repository

Specifies the repository to publish to.

Właściwości parametru

Typ:String
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-SkipDependenciesCheck

Bypasses the default check that all dependencies are present in the target repository.

Właściwości parametru

Typ:SwitchParameter
Domyślna wartość:False
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-SkipModuleManifestValidate

Skips validating the module manifest before publishing.

Właściwości parametru

Typ:SwitchParameter
Domyślna wartość:False
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Właściwości parametru

Typ:SwitchParameter
Domyślna wartość:False
Obsługuje symbole wieloznaczne:False
DontShow:False
Aliasy:wi

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów: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.

Dane wejściowe

None

Dane wyjściowe

Object

Uwagi

The module defines pbres as an alias for Publish-PSResource.

Fileshare-based repository have no metadata about the resources. Therefore, there is no way to check for dependencies.