0

Error message:

System.Runtime.Serialization.SerializationException : Unable to find assembly 'MyCompany.Plates, Version=12.15.0.0, Culture=neutral, PublicKeyToken=0b9f95a95d107d22'. +++++++++++++++++++ STACK TRACE: at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()

There are two DLL files:

PlatesTests.dll and MyCompany.Plates.dll

The tests are all in PlatesTests.dll. The objects being serialized are in MyCompany.Plates.dll.

When run by passing PlatesTests.dll to nunit-console.exe, everything passes.

However, our build system uses a .nunit file as under:

<NUnitProject>
  <Settings activeconfig="Default" />
  <Config name="Default" binpathtype="Auto">
    <assembly path="..\..\Build Products\ReleaseTests\PlatesTests.dll" />
   </Config>
</NUnitProject>

And when the nunit-console is run against this .nunit file, it gives the above error.

How can I fix this problem?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ali
  • 1,462
  • 2
  • 17
  • 32

2 Answers2

0

I believe that you have to run the console project with /noshadow

From the documentation

The /noshadow option disables shadow copying of the assembly in order to provide improved performance.

This shadow copying sometimes causes assembly loading to fail for projects.

Justin Pihony
  • 66,056
  • 18
  • 147
  • 180
0

I fixed this by setting the appbase on the .nunit setting file to point to where PlatesTests.dll and MyCompany.Plates.dll are both located.

The new file looks like this:

<NUnitProject>
  <Settings activeconfig="Default" appbase="..\..\Build Products\ReleaseTests" />
  <Config name="Default" binpathtype="Auto">
    <assembly path="..\..\Build Products\ReleaseTests\PlatesTests.dll" />
  </Config>
</NUnitProject>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ali
  • 1,462
  • 2
  • 17
  • 32