Pregunta

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?

¿Fue útil?

Solución

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>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top