gpt4 book ai didi

c# - Cake build.ps1安装Cake失败

转载 作者:行者123 更新时间:2023-12-02 21:17:00 26 4
gpt4 key购买 nike

我们使用 Cakebuild.net 提供的标准 build.ps1 PowerShell 脚本

它在 CI 和开发人员机器上都表现出色,但对于我们的一位开发人员来说,我们在启动 build.ps1 时遇到以下错误

Unable to find package 'Cake'

然后退出,检查tools文件夹没有安装Cake。

最佳答案

您收到的错误是因为 NuGet 控制台无法在计算机上配置的源中找到 Cake 包。

您可以通过更改 build.ps 中的以下行来测试该理论。

$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""

$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`" -Source `"https://www.nuget.org/api/v2`""

如果这有效,您同事的机器可能缺少或禁用了标准 nuget.org feed。

您可以像这样使用 NuGet 控制台列出已配置的源(如果您的路径中没有 nuget 控制台,则应在存储库工具文件夹中使用它)

nuget sources list

然后它应该列出 nuget.org 的 v2 和/或 v3 feed,并且它们后面应该有文本 [Enabled],如下所示

Registered Sources:

1. https://www.nuget.org/api/v2/ [Enabled]
https://www.nuget.org/api/v2/
2. https://api.nuget.org/v3/index.json [Enabled]
https://api.nuget.org/v3/index.json

如果它们已列出但已禁用,您可以通过键入来启用它们

nuget source enable -Name https://www.nuget.org/api/v2/

或者

nuget source enable -Name  https://api.nuget.org/v3/index.json

根据您注册和禁用的提要,如果源丢失,您可以通过键入添加它们

nuget sources add -Name https://www.nuget.org/api/v2/ -Source  https://www.nuget.org/api/v2/

设置存储在 %AppData%\NuGet\NuGet.config 中,因此您可以手动编辑该文件,为确保团队中的每个人都使用相同的源,您可以添加 NuGet.config 到存储库的根目录,因为 nuget 尝试在路径中查找配置,然后返回到应用程序数据。

关于c# - Cake build.ps1安装Cake失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38792473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com