Question

I'm having the following error while executing some integration tests:

The assembly with display name 'System' failed to load in the 'Load' binding context of the AppDomain with ID 4. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'System, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

These tests used to work in the past and I don't know how can be that such a basic dll is not found. Moreover, the System assembly has been already loaded:

enter image description here

By the way, the code executing is creating AppDomains to execute Integration tests in case this matters.

EDIT: Looks like we have the required frameworks installed:

enter image description here

Was it helpful?

Solution 3

I finally found the problem: the app.config was corrupted due to a "too wide" search and replace and seems that this was the culprit of the strange System load.

OTHER TIPS

This error can happen when the test environment doesn't have the targeted framework installed. Especially when you are using late binding. This might be the case if you are using an IOC/DI.

Be advised, that it can also be caused (due to late binding), that an other (extra) .NET version is required. If one of the components used in the program are compiled against, lets say, .NET 2.0 it might be necessary to install that framework version as well.

This can happen when your application is targetting a different version of the DotNet framework than is installed on the machine you are testing with. I note that all these assemblies required are 4.0, but it also looks like you are showing the output from the modules window in VS2012+, so its pretty likely that 4.0 is installed.

Next we look at the runtime environment that your integration test is runnign in. Because with DotNet the verison of the framework that you will use for ALL assembly loads is defined by the initial executable. Normally this isnt a problem because if you use a 4.0 exe, and refer to 2.0 framework then the new ones can usually be substituted. However if you run the 2.0 version then it will not be able to resolve the 4.0 assemblies.

If you are using NUnit then there some tricks you can use to assist i to get around this problem. http://nunit.org/index.php?p=runtimeSelection&r=2.6.3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top