다음을 통해 공유


Windows PowerShell 5.1용 NuGet 구성 요소 부트스트랩

Windows의 새 배포에서 Windows PowerShell 5.1은 PowerShell 갤러리와 상호 작용하는 데 필요한 NuGet 구성 요소에 포함되지 않습니다. PowerShellGet에는 PowerShell 갤러리에 연결할 수 있는 한 이러한 구성 요소를 업데이트하는 논리가 포함되어 있습니다. 컴퓨터가 인터넷에 연결되어 있지 않은 경우 필요한 파일을 신뢰할 수 있는 원본에서 연결이 끊긴 컴퓨터로 복사해야 합니다.

필요한 NuGet 구성 요소는 PowerShellGet v2+ 및 PackageManagement v1.1 이상에 포함됩니다. 이러한 모듈의 최신 버전은 PowerShell 갤러리에서 사용할 수 있으며 PowerShell 6 이상에 포함되어 있습니다. 이러한 지침은 Windows PowerShell 5.1에 대한 것입니다.

중요하다

NuGet 구성 요소를 부트스트래핑한 후 지원되는 최신 버전의 PowerShellGet 및 PackageManagement 모듈을 설치해야 합니다.

인터넷에 연결된 컴퓨터의 부트스트랩

다음 프로세스에서는 컴퓨터가 인터넷에 연결되어 있으며 공용 위치에서 파일을 다운로드할 수 있다고 가정합니다.

오류: 계속하려면 NuGet 공급자가 필요합니다.

컴퓨터에서 NuGet 공급자를 사용할 수 없는 경우 이 오류가 발생합니다.

Find-Module -Repository PSGallery -Verbose -Name Contoso

Y 사용하여 프롬프트에 응답하여 NuGet 공급자를 설치합니다.

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet
-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageMan
agement\ProviderAssemblies' or 'C:\Users\user1\AppData\Local\PackageManagement\ProviderAs
semblies'. You can also install the NuGet provider by running 'Install-PackageProvider -N
ame NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and imp
ort the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet provider.

Version    Name                                Type       Repository           Description
-------    ----                                ----       ----------           -----------
2.5        Contoso                             Module     PSGallery        Contoso module

오류: 계속하려면 NuGet.exe 필요합니다.

NuGet 공급자를 사용할 수 있지만 nuget.exe 이진 파일이 아닌 경우 이 오류가 발생합니다.

Publish-Module -Name Contoso -Repository PSGallery -Verbose

nuget.exe설치할 Y 프롬프트에 응답합니다.

NuGet.exe is required to continue
PowerShellGet requires NuGet.exe to publish an item to the NuGet-based repositories. NuGe
t.exe must be available under one of the paths specified in PATH environment variable val
ue. Do you want PowerShellGet to install NuGet.exe now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet.exe.
VERBOSE: Successfully published module 'Contoso' to the module publish location 'https://
www.powershellgallery.com/api/v2/'.
Please allow few minutes for 'Contoso' to show up in the search results.

오류: 계속하려면 NuGet.exe 및 NuGet 공급자가 필요합니다.

NuGet 공급자와 nuget.exe 모두 설치되지 않은 경우 이 오류가 표시됩니다.

Publish-Module -Name Contoso -Repository PSGallery -Verbose

NuGet 공급자와 nuget.exe모두 설치하려면 Y 프롬프트에 응답합니다.

NuGet.exe and NuGet provider are required to continue
PowerShellGet requires NuGet.exe and NuGet provider version '2.8.5.201' or newer to inter
act with the NuGet-based repositories. Do you want PowerShellGet to install both NuGet.ex
e and NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet provider.
VERBOSE: Installing NuGet.exe.
VERBOSE: Successfully published module 'Contoso' to the module publish location 'https://
www.powershellgallery.com/api/v2/'.
 Please allow few minutes for 'Contoso' to show up in the search results.

인터넷에 연결되지 않은 컴퓨터의 부트스트랩

다음 프로세스에서는 컴퓨터가 인터넷에 연결되어 있지 않다고 가정합니다. 필요한 구성 요소를 설치하려면 인터넷에 연결된 컴퓨터의 부트스트랩 프로세스에 따라 오프라인 신뢰할 수 있는 프로세스를 통해 공급자를 격리된 노드에 수동으로 복사합니다.

  1. NuGet 공급자 파일을 오프라인 컴퓨터에 복사합니다.

    연결된 컴퓨터에서 오프라인 컴퓨터의 동일한 위치에 C:\Program Files\PackageManagement\ProviderAssemblies\NuGet 폴더를 복사합니다.

  2. PowerShellGet 및 PackageManagement 모듈을 오프라인 컴퓨터에 복사합니다.

    연결된 컴퓨터에서 오프라인 컴퓨터의 동일한 위치로 다음 모듈 폴더를 복사합니다.

    • C:\Program Files\WindowsPowerShell\Modules\PowerShellGet
    • C:\Program Files\WindowsPowerShell\Modules\PackageManagement