【发布时间】:2020-10-07 22:33:58
【问题描述】:
我在带有 Chocolatey 链接的 PowerShell 控制台中出现错误。
如果没有解决方案,我需要学习如何使用下载的文件“chocolatey.0.10.15.nupkg”安装 Chocolatey。
【问题讨论】:
标签: powershell nuget chocolatey
我在带有 Chocolatey 链接的 PowerShell 控制台中出现错误。
如果没有解决方案,我需要学习如何使用下载的文件“chocolatey.0.10.15.nupkg”安装 Chocolatey。
【问题讨论】:
标签: powershell nuget chocolatey
安装 choco 是一个非常常见的用例,包括 NuGet。
PowerShell 已经附带了一个包管理器,它使用默认情况下已经安装的 NuGet。您仍然可以出于其他原因安装 choco,但对于日常正常 PowerShell 使用,不需要它。
安装 PowerShellGet https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7
PowerShellGet 是以下版本 Windows 10 中的内置模块 或更新的 Windows Server 2016 或更新的 Windows 管理框架 (WMF) 5.0 或更新的 PowerShell 6
在您的 PowerShell 会话中设置您的安全级别。
# Required for use with web SSL sites
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
如果您的 ExecutionPolicy 设置为 AllSigned,那么您运行的任何脚本都必须经过签名。否则,请在您的用户会话中将 ExecutionPolicy 设置为 RemoteSigned 或 ByPass。
How to Install Chocolatey using PowerShell
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression (
(New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
)
【讨论】: