Build/Test Issues

.net core 2.0 and refence errors

Started by mhjorth on 2,981 views

I am trying to use NCrunch on a .net core 2.0 project but I'm running into som refernce problems.

Currently I'm having problems with this error:

System.IO.FileNotFoundException : Could not load file or assembly 'System.ComponentModel.TypeConverter, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
at ConsoleApp3.Program.TcTest()

This assembly is part of the .net core 2.0 platform and I believe I shouldn't care about referencing it.

What am I doing wrong here?

Michael.

I have this simple console program to demonstrate the problem:

public class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var tt = TcTest();
Console.WriteLine($"{tt}");
var p = Console.Read();
}

public static string TcTest()
{
var tc = new TypeConverter();
var tt = tc.ConvertToString("string");
return tt;
}
}

And this simple test (NUnit):
public class UnitTest1
{
[Test]
public void TestMethod1()
{
Program.TcTest();
}
}
Hi, thanks for sharing this problem.

This problem is in NCrunch's integration with the .NET Core platform. It's a limitation caused by the side-by-side versioning of NCrunch's .NET Core libraries (which are on .NET Core 1.0/1.1) with the .NET Core 2.0 environment.

We've been looking at ways to resolve this, but as the most feasible way seems to be to remove support for .NET Core 1.1 test projects, it's something that may happen much later down the line.

To fix it, just introduce a Nuget reference from your test project to System.ComponentModel.TypeConverter.
Thank you for the reply.

At least there is an explanation.

I can confirm it works by adding the TypeConverter NuGet package to my test project.

Michael.

Post a reply

Log in to reply.