Have you ever experienced that you get a long list of compilation errors after adding Moles Assembly on a reference? The other day I was stucked with several compile errors like:
The command ""C:\Program Files\Microsoft Moles\bin\moles.exe" @"D:\…\obj\Debug\Moles\moles.args"" exited with code –1007
‘System.Net.Moles.SFileWebResponse.Dispose(bool)’: no suitable method found to override [D:\...\obj\Debug\Moles\s\m.g.csproj]
Cannot call an abstract base member: ‘System.Xml.XmlReader.Close()’ [D:\...\obj\Debug\Moles\sx\m.g.csproj]
The command ""C:\Program Files\Microsoft Moles\bin\moles.exe" @"D:\…\obj\Debug\Moles\moles.args"" exited with code –1002
I tried to clean, rebuild, restart, re-add, redo and all the other tricks you do when you see a very unreasonable compile error in Visual Studio. The solution seem to be way more unlogical, but it works – so no questions asked at this time.
<Assembly Name="System.Xml" ReflectionOnly="true"/>
I should mention that while searching for a good explanation for this, I found little information, but it seemed that everybody affected by this was using Visual Studio 2010 SP1. Still, using this version on many other computers, this was the only time I ran into this issue. And I did so with adding Moles assembly for System.Xml