FsUnit and Visual Studio 2013 “Could not load file or assembly ‘FSharp.Core, Version=…”

If you have been developing software for a while, you should already realize how essential unit testing is for your project. However, for F# programmer, Visual Studio doesn’t come with F# Unit Test Project. As F# is one of CLI languages, you can either use C# Unit Test Project or use F# syntax to test your F# code instead.

However, if you want to test F# with F#, there are many F# testing tools and libraries that you can try. What I use is FsUnit which has well-known F# contributors like Daniel Mohl and Tomas Petricek.

You can easily grab the FsUnit by using NuGet (FsUnit comes with NUnit by default, but it also supports MbUnit, xUnit, and MsTest).

But when you create a F# project on Visual Studio 2013 and run the FsUnit tests for the first time, you might see this error message with red unit test:

“System.IO.FileLoadException : Could not load file or assembly ‘FSharp.Core, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)”


The easiest way to fix it is to add bindingRedirect to the configuration file (i.e., app.config or web.config).

        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />


And it should resolve your issue.


Happy coding!


5 thoughts on “FsUnit and Visual Studio 2013 “Could not load file or assembly ‘FSharp.Core, Version=…”

  1. Pingback: F# Weekly #48, 2013 | Sergey Tihon's Blog

  2. Thanks! Current version seems to be looking for the wrong version of xunit, but this fix works for that too.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s