Question

I'm trying Moles for the first time. When I try to add a Moles assembly on System.Windows.Forms it generates code with references to System.Collections.Generic.IReadOnlyCollection and IReadOnlyList which doesn't compile because they are only in .NET Framework 4.5 and my projects are all 4.0 in VS2010. I've set the assembly references to specific versions but that didn't help. Any ideas?

Était-ce utile?

La solution

If you are running Moles in Visual Studio 2012, you will need to explicitly exclude certain assemblies and types.

Here's what works for me:

<Assembly Name="System.Windows.Forms" ReflectionOnly="true"/>
<StubGeneration>
    <Types>
        <Clear />
        <Add FullName="Your.Type.Full.Name!" />
    </Types>
</StubGeneration>
<MoleGeneration>
    <Types>
        <Clear />
        <Add FullName="Your.Type.Full.Name!" />
    </Types>
</MoleGeneration>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top