Mock.Create<>() requiring strong name

1

I have the following dependency tree

  • MyFramework
  • DataAccess
  • Processor
  • Processor.Tests

Each assembly references on all of the ones above it. So Processor.Tests references Processor, DataAccess, and MyFramework. With the exception of ProcessorTests reference to Processor all references are through a private Nuget server.

There is an interface (IMessageLogger) in the DataAccess assemble that I need to mock. One of the methods in that interfaces has an argument of a type defined in MyFramework.

When I try to Mock.Create<IMessageLogger>() I get the following exception

System.IO.FileLoadException : Could not load file or assembly 'MyFramework, Version=2017.12.12.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

None of my assemblies are strong named, but Telerik.JustMock is strong named, but it hasn't given me any trouble mocking any other interfaces so far.

Anyone have any idea how I might be able to work around this?

c#
strongname
justmock

1 Answer

0

It turns out the problem was that I had the Processor and Processor.Test projects were referencing version 2018.3.15 of the MyFramework assembly, but the DataAccess project was referencing an older version (2017.12.12.1).

Updated all of the projects to use the latest and everything is running again.

answered on Stack Overflow Apr 2, 2018 by Jeremy Hutchinson

User contributions licensed under CC BY-SA 3.0