2

我在 Linux 下有一个现有的 F#/Mono/paket/fake 项目,用于正确编译。

我使用 apt-get 更新了单声道,现在我的项目无法编译。

它找不到两个引用的包:MathNet.Numerics 和 Newtonsoft.Json。

这是我在构建项目时得到的:

Primary reference "MathNet.Numerics".
/usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "MathNet.Numerics". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/home/bleakcabal/Documents/projects/genesis/genesis/genesis/genesis.fsproj]
          For SearchPath "{TargetFrameworkDirectory}".
          Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5/MathNet.Numerics.winmd", but it didn't exist.
          Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5/MathNet.Numerics.dll", but it didn't exist.
          Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5/MathNet.Numerics.exe", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/MathNet.Numerics.winmd", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/MathNet.Numerics.dll", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/MathNet.Numerics.exe", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/Facades/MathNet.Numerics.winmd", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/Facades/MathNet.Numerics.dll", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/Facades/MathNet.Numerics.exe", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/Facades/MathNet.Numerics.winmd", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/Facades/MathNet.Numerics.dll", but it didn't exist.
          Considered "/usr/lib/mono/4.5-api/Facades/MathNet.Numerics.exe", but it didn't exist.
          For SearchPath "{GAC}".
          Considered "MathNet.Numerics", which was not found in the GAC.
          For SearchPath "{RawFileName}".
          Considered treating "MathNet.Numerics" as a file name, but it didn't exist.
          For SearchPath "/home/bleakcabal/Documents/projects/genesis/build/".
          Considered "/home/bleakcabal/Documents/projects/genesis/build/MathNet.Numerics.winmd", but it didn't exist.
          Considered "/home/bleakcabal/Documents/projects/genesis/build/MathNet.Numerics.dll", but it didn't exist.
          Considered "/home/bleakcabal/Documents/projects/genesis/build/MathNet.Numerics.exe", but it didn't exist.

该文件位于packages我的项目中的一个文件夹中(我使用 Ionide-fsharp 和使用 paket 和 fake 的 VS 代码创建了该文件夹),但该文件夹未出现在错误消息中。

我收到了与 Newtonsoft.Json 完全相同的消息。

这是我的paket.dependencies文件:

source https://www.nuget.org/api/v2

nuget FAKE
nuget FSharp.Core
nuget MathNet.Numerics
nuget Newtonsoft.Json

我的paket.lock文件太长,无法发布,但以下是相关部分:

MathNet.Numerics (3.19)
      TaskParallelLibrary (>= 1.0.2856) - framework: net35

Newtonsoft.Json (10.0.2)
      Microsoft.CSharp (>= 4.3) - framework: netstandard10, >= netstandard13
      NETStandard.Library (>= 1.6.1) - framework: netstandard10, >= netstandard13
      System.ComponentModel.TypeConverter (>= 4.3) - framework: netstandard10, >= netstandard13
      System.Runtime.Serialization.Formatters (>= 4.3) - framework: >= netstandard13
      System.Runtime.Serialization.Primitives (>= 4.3) - framework: netstandard10, >= netstandard13
      System.Xml.XmlDocument (>= 4.3) - framework: >= netstandard13

.fsproj这是我引用这些包的多个文件之一的摘录:

...
<Reference Include="MathNet.Numerics" />
<Reference Include="Newtonsoft.Json" />
...
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v3.5'">
  <ItemGroup>
    <Reference Include="MathNet.Numerics">
      <HintPath>..\..\packages\MathNet.Numerics\lib\net35\MathNet.Numerics.dll</HintPath>
      <Private>True</Private>
      <Paket>True</Paket>
    </Reference>
  </ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
  <ItemGroup>
    <Reference Include="MathNet.Numerics">
      <HintPath>..\..\packages\MathNet.Numerics\lib\net40\MathNet.Numerics.dll</HintPath>
      <Private>True</Private>
      <Paket>True</Paket>
    </Reference>
  </ItemGroup>
</When>

如果我这样做,mono --version我会得到以下信息:

Mono JIT compiler version 5.0.1.1 (2017-02/5077205 Thu May 25 09:16:53 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com

我尝试使用以下命令但无济于事:.paket/paket.exe restore, .paket/paket.exe install, .paket/paket.exe outdated.

4

2 回答 2

1

要运行 paket,您需要运行

$ mono paket.exe install

如果您仍然遇到缺少程序集或引用不正确的问题,请尝试

$ apt-get install mono-dev

或者

$ apt-get install mono-complete

有关 Mono 安装的更多信息,请查看http://www.mono-project.com/download/#download-lin

于 2017-06-09T00:49:38.027 回答
1

我最终做了paket.exe update --redirects类似@TaylorFraley 推荐的修改了一些文件的操作。

然后使用 paket ionide 插件,我从我的解决方案中删除了这两个包。

然后,我在解决方案中搜索了关于这两个包(我的 .fsproj 中的两个参考包含)的任何剩余内容,然后我手动删除了它们。

我再次使用 paket Ionide 插件重新安装了软件包,一切正常。

所以解决方案是删除所有内容并再次添加它们。不知道为什么 paket 更新不起作用。

于 2017-06-10T00:38:12.650 回答