문제

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?

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top