【问题标题】:MathNet Numerics needs FsUnit.CustomMatchers to successfully build. Ran out of optionsMathNet Numerics 需要 FsUnit.CustomMatchers 才能成功构建。用完了选项
【发布时间】:2016-02-26 17:59:31
【问题描述】:

尝试使用 Visual Studio Community 15MathNet.Numerics.slnGitHub 构建最新版本的 MathNet Numerics,这需要安装用于单元测试的 DLL。

Could not resolve this reference. Could not locate the assembly "FsUnit.CustomMatchers".
Could not resolve this reference. Could not locate the assembly "FsUnit.NUnit". 
Could not resolve this reference. Could not locate the assembly "nunit.framework". 

因此,在 Visual Studio 中使用 NuGet 可以成功安装以下内容。

Successfully installed 'NUnitTestAdapter.WithFramework 2.0.0' to UnitTests  
Successfully installed 'FSharp.Core 3.1.2.5' to FSharpUnitTests  
Successfully installed 'NUnit 3.0.1' to FSharpUnitTests  
Successfully installed 'FsUnit 2.0.0' to FSharpUnitTests  

剩下的唯一DLL是

FsUnit.CustomMatchers

我找不到。

hint..\..\packages\test\FsUnit\lib\FsUnit.CustomMatchers.dll,但packages下没有test目录。

如何正确解决这个问题?
我是否需要 DLL,如果需要,它可以在哪里找到?
我需要手动修复代码吗?
我需要更新提示吗?

TLDR;

如果我在没有缺少 DLL 的情况下构建,则基本错误是:

A unique overload for method 'IsTrue' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: 
Assert.IsTrue(condition: Nullable<bool>, message: string, [<ParamArray>] args: obj []) : unit, 
Assert.IsTrue(condition: bool,           message: string, [<ParamArray>] args: obj []) : unit

可以通过安装解决

Microsoft.VisualStudio.QualityTools.UnitTestFramework

添加

open Microsoft.VisualStudio.TestTools.UnitTesting

签名为

Assert.IsTrue(condition: bool, message: string, [<ParamArray>] args: obj []) : unit

但这是不正确的,因为它没有安装正确的 DLL(Microsoft.VisualStudio.QualityTools.UnitTestFramework.dllFsUnit.CustomMatchers),并且根据过去 F# 单元测试的经验,我知道这样做可能会导致误报。

编辑:

成功安装后,我想知道这是在哪里记录的。

见:Building Math.NET Numerics

全自动构建,包括 unit tests、文档和 api 参考,NuGet 和 Zip 包使用 FAKE。

【问题讨论】:

    标签: f# visual-studio-2015 nunit mathnet-numerics fsunit


    【解决方案1】:

    该解决方案使用 F# 包系统 Paket。不是 NuGet。它还使用 F# 构建系统 FAKE

    要恢复、配置和构建所有内容,只需运行 build.cmd(如果您使用的是 *NIX,则运行 build.sh)。


    路径的/test/ 部分来自Paket 的一个名为“dependency group”的东西。简而言之,它允许您按某些标准对依赖项进行分组,然后有选择地恢复它们,而不是“所有依赖项,一直”。

    paket.dependencies file 来看,这个特定的项目定义了四个组 - 测试、构建、数据和基准测试。我可以猜测“构建”具有常规构建所需的依赖项,而“测试”具有测试所需的依赖项。


    要使用 Paket 恢复依赖关系,您需要下载 Paket,然后运行 ​​paket install

    为了简化下载部分,该解决方案包括一个位于.paket/paket.bootstrapper.exe 的引导程序,您可以运行它来下载最新的Paket。这是一个标准的东西,当你通过运行paket init初始化一个新项目时添加它。

    整个过程(即运行引导程序,然后运行 ​​Paket 本身)被编码在 build.cmdbuild.sh 文件中,然后运行 ​​FAKE。这就是为什么我建议你直接运行build.cmd

    【讨论】:

    • 您可以从 GitHub 下载 Paket:github.com/fsprojects/Paket/releases/tag/2.50.11 但是,您无需通过浏览器进行下载:paket.bootstrapper.exe 将为您下载并解压。如果您仍然感到困惑,只需看看build.cmd 做了什么:github.com/mathnet/mathnet-numerics/blob/master/build.cmd
    • 就像我在答案中所说的那样,规范是运行build.cmd。不要试图打扰更多细节,只需运行build.cmd
    • 我通过删除整个目录做了几次,是的,只需要运行build.cmd 就可以了。其他人需要注意的是,测试在流程结束时运行,其中一项测试失败,但在 build.cmd 完成后,我能够在 Visual Studio 中成功(构建 -> 重建解决方案)。
    猜你喜欢
    • 2020-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多