1

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.

Guy Coder
  • 24,501
  • 8
  • 71
  • 136

1 Answers1

2

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.

Fyodor Soikin
  • 78,590
  • 9
  • 125
  • 172
  • You can download Paket from GitHub: https://github.com/fsprojects/Paket/releases/tag/2.50.11 However, you don't need to do that via browser: `paket.bootstrapper.exe` will download and unpack it for you. If you're still confused, just look at what `build.cmd` does: https://github.com/mathnet/mathnet-numerics/blob/master/build.cmd – Fyodor Soikin Feb 26 '16 at 18:33
  • 1
    Like I said in the answer, the norm is to run `build.cmd`. Don't try to bother with more details, just run `build.cmd`. – Fyodor Soikin Feb 26 '16 at 19:06
  • I did it a few times by deleting the entire directory and yes just running `build.cmd` is all that is needed. Of note to others, test are run at the end of the process and one of the test failed, but after the build.cmd finished I was able to successfully (Build -> Rebuild Solution) in Visual Studio. – Guy Coder Feb 26 '16 at 19:31