MathNet Numerics needs FsUnit.CustomMatchers to successfully build. Ran out of options

109 Views Asked by At

In trying to build the latest version of MathNet Numerics from GitHub using Visual Studio Community 15 with MathNet.Numerics.sln which needs DLLs for unit testing installed.

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". 

So using NuGet from within Visual Studio the following can be successfully installed.

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  

The only DLL remaining is

FsUnit.CustomMatchers

which I am unable to locate.

The hint is ..\..\packages\test\FsUnit\lib\FsUnit.CustomMatchers.dll, yet there is not test directory under packages.

How do I correctly resolve this?
Do I need the DLL and if so where can it be located?
Do I need to make a manual code fix?
Do I need to update the hint?

TLDR;

If I build without the missing DLL the basic error is:

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

which can be resolved by installing

Microsoft.VisualStudio.QualityTools.UnitTestFramework

and adding

open Microsoft.VisualStudio.TestTools.UnitTesting

which has the signature of

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

but that is not correct as it does not install the correct DLL (Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll vs FsUnit.CustomMatchers) and from past experience with F# Unit testing I am aware of the subtitles that could allow false positives by doing such.

EDIT:

After successfully installing I wanted to know where this was documented.

See: Building Math.NET Numerics

The fully automated build including unit tests, documentation and api reference, NuGet and Zip packages is using FAKE.

1

There are 1 best solutions below

3
On BEST ANSWER

That solution is using Paket, the F# package system. Not NuGet. It also uses FAKE, the F# build system.

To have everything restored, configured and built, simply run build.cmd (or build.sh if you're on *NIX).


The /test/ part of the path comes from something called "dependency group", a feature of Paket. In a nutshell, it lets you group your dependencies by some criteria, and then restore them selectively rather than "all dependencies, all the time".

This particular project, judging by its paket.dependencies file, defines four groups - Test, Build, Data, and Benchmark. I can guess that "Build" has dependencies needed for regular build, and "Test" has dependencies needed for testing.


To restore dependencies using Paket, you need to download Paket and then run paket install.

In order to streamline the downloading part, the solution includes a bootstrapper at .paket/paket.bootstrapper.exe, which you can run to have the latest Paket downloaded. This is a standard thing, it is added when you initialize a new project by running paket init.

And the whole process (i.e. running the bootstrapper and then running Paket itself) is encoded in build.cmd and build.sh files, along with running FAKE afterwards. This is why I suggested that you simply run build.cmd.