Missing project dependency when referring project

Viewed 1512

I'm facing some issues with dependencies when referring projects in Visual Studio. Here is how my solution ReferenceTest is structured:

  • Common. A class library containing a static CommonClass.HelloWorld() method returning a string. The string returned by this method is read from a JSON config file using Microsoft.Extensions.Configuration (and a large set of its dependencies) installed using NuGet.
  • ConsoleApplication1. A console application writing the CommonClass.HelloWorld() string to the console using a static Worker.DoWork() method. This console application has a project reference to the Common project.
  • ConsoleApplication1Test. A class library using NUnit for testing that the Worker.DoWork() method from the ConsoleApplication1 is returning the expected string. This class library has a project reference to the ConsoleApplication1 project.

The ConsoleApplication1 console application is working as expected, but when running the unit test in ConsoleApplication1Test I get this exception:

System.IO.FileNotFoundException : Could not load file or assembly 'System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

The System.Runtime.dll file (and perhaps others) is not copied to the bin-folder when compiling the ConsoleApplication1Test project. Why is this happening?

A zip-file with the demo solution can be found here: http://www.filedropper.com/referencetest

2 Answers
Related