Cake build.ps1无法安装Cake [英] Cake build.ps1 fails to install Cake
问题描述
我们使用Cakebuild.net提供的标准build.ps1 PowerShell脚本
We use the standard build.ps1 PowerShell script supplied from Cakebuild.net
它在CI和开发人员机器上都表现出色,但是对于我们的其中一位开发人员,我们得到了启动build.ps1
It's worked splendid on both CI and developer machines, but for 1 of our developers we get the following error when launching build.ps1
Unable to find package 'Cake'
然后退出,检查工具文件夹中没有安装Cake。
And then exits, checking tools folder there's no Cake installed.
推荐答案
您得到的错误是因为NuGet控制台无法在计算机上已配置的提要中找到Cake程序包。
The error you're getting is because NuGet console can't find the Cake package among the configured feeds on the machine.
您可以测试此理论通过在 build.ps 中更改以下行p>
You can test this theory by changing the following line in 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提要。
If that works your colleagues machine likely lacks or have the standard nuget.org feeds disabled on his machine.
您可以像这样使用NuGet控制台列出配置的源(如果路径中没有nuget控制台,则应该在回购工具文件夹中使用)
You can list which sources you have configured by using the NuGet console like this (if you don't have nuget console in path it should be avail in the repo tools folder)
nuget sources list
然后应列出nuget.org的第2版和/或第3版供稿,并在其后添加如下文字 [Enabled]
It should then list v2 and/or v3 feed for nuget.org and they should have the text [Enabled]
after them like below
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
如果已列出但已禁用,则可以通过键入
If they're listed but disabled you can enable them by typing
nuget source enable -Name https://www.nuget.org/api/v2/
或
nuget source enable -Name https://api.nuget.org/v3/index.json
根据您注册的供稿&禁用,如果缺少源,则可以通过键入
Depending on which feed you have registered & disabled, if the sources are missing then you can add them by typing
nuget sources add -Name https://www.nuget.org/api/v2/ -Source https://www.nuget.org/api/v2/
设置存储在%AppData%\NuGet\NuGet.config
中,因此您可以手动编辑该文件,以确保每个人在团队中使用相同的来源nuget尝试在路径中找到配置,然后回退到应用程序数据时,将 NuGet.config
到存储库的根目录。
Settings are stored in %AppData%\NuGet\NuGet.config
so you could manually edit that file, to make sure everyone uses same sources in team you could add a NuGet.config
to the root of the repository as nuget tries to find config in path and then falls back to app data.
这篇关于Cake build.ps1无法安装Cake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!