我们使用从build.ps1提供的标准PowerShell脚本。
它在CI和developer机器上都做得很好,但是对于我们的一个开发人员,我们在启动build.ps1时会出现以下错误
Unable to find package 'Cake'然后退出,检查工具文件夹--没有安装Cake。
发布于 2016-08-05 15:09:26
您所收到的错误是因为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提要。
您可以像这样使用NuGet控制台列出配置了哪些源(如果路径中没有nuget控制台,那么它在repo文件夹中应该是有用的)
nuget sources list然后,它应该列出v2和/或v3提要中的nuget.org,并且它们后面应该有文本[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尝试在path中查找配置,然后返回到app数据时,将一个NuGet.config添加到存储库的根目录。
https://stackoverflow.com/questions/38792473
复制相似问题