2017-07-08 89 views
6

更新。在Matt Ward的帮助下,我将其追溯到一个糟糕的配置文件中。下面的〜/的.config /的NuGet/NuGet.Config对我的作品单声道编译失败,NuGet错误

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
<packageSources> 
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" protocolVersion="2" /> 
</packageSources> 
    <packageSources> 
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> 
</packageSources> 
</configuration> 

我可以做以下没有任何问题:

/opt/mono/mono-5.2.0.196-tarball/bin/mono ~/nuget.exe install -version 2.6.4 nunit 

然而,当我尝试编译fsharp相同的安装下单声道,我得到以下错误。这是在fsharp4分支。请问我可能会做错什么?非常感谢。

工程 “/dir/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj” (默认目标(S)):目标CallFsSrGen:创建目录 “OBJ /原/。 /”工具 /dir/src/fsharp/FSharp.Build-proto/../../../lib/bootstrap/4.0/fssrgen.exe 执行开始参数: /DIR/src目录/ fsharp/fSharp .Build/FSBuild.txt OBJ /原/./ FSBuild.fs FSBuild.resx目标BeforeBuild:执行:单 --runtime = v4.0.30319 /dir/src/fsharp/FSharp.Build-proto/../。 ./../.nuget/NuGet.exe restore packages.config -PackagesDirectory程序包无法找到版本 'NUnit'包'2.6.4'。无法找到 包'NUnit.Runners'的版本'2.6.4'。 /dir/src/FSharpSource.targets:error: Command'mono --runtime = v4.0.30319 /dir/src/fsharp/FSharp.Build-proto/../../../.nuget/NuGet .EXE恢复 packages.config -PackagesDirectory包的代码退出:1. 任务‘Exec的’执行 - 在不合格项目完成建设目标‘BeforeBuild’

+1

您是否试图从命令行进行编译? – mydogisbox

+1

正确。我正在使用通常的基于makefile的构建。它在过去使用过同一台计算机(在较旧的Mono下,并且可能具有不同版本的f#git树)。 – John

+0

检查您正在使用的NuGet版本以及启用了哪些NuGet程序包源代码。我的猜测是,你没有启用NuGet软件包源,或者你正在使用NuGet v2 .exe和NuGet v3软件包源。 –

回答

2

检查你使用的是什么版本的NuGet和什么NuGet包源被启用。无论是否启用NuGet软件包源,或者您正在使用带有NuGet v3软件包源的NuGet v2 .exe。

如果没有随您使用的FSharp build源代码一起提供的NuGet.Config文件,请检查文件~/.config/NuGet/NuGet.config中列出的软件包源。我怀疑它只有v3软件包源https://api.nuget.org/v3/index.json,它不能与NuGet.exe(v2)一起使用。因此,您需要将nuget.exe更新到更高版本,或者将NuGet v2软件包源添加到NuGet.Config文件中:https://www.nuget.org/api/v2/

+0

再次感谢您的帮助。 – John