Shims for library class not created

352 views Asked by At

I want to use fakes(shims) to mock nj4x library. I followed the guidelines here to generate them: https://msdn.microsoft.com/en-us/library/hh549174.aspx

However fakes for some classes are not generated. I tried solutions suggested here: Shims are not generated for .NET methods

Shims are not generated for .NET methods

but still not working. When I build, I get this warning:

Cannot generate shim for nj4x.Strategy: Could not resolve assembly 'NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c'. Are you missing an assembly reference?.

My assembly file for now is

<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/"
       Diagnostic="true">
  <Assembly Name="nj4x" Version="2.5.6.0"/>
  <ShimGeneration>
    <Clear/>
    <Add Namespace="nj4x!"/>
    <Add Namespace="nj4x.metatrader!"/>
  </ShimGeneration>
</Fakes>

I have tried several other thins too but not working. I am really stuck here.

1

There are 1 answers

0
Usama Aslam On BEST ANSWER

I don't really know why but once I add fakes for NLog, fakes for required classes of nj4x are generated.