.net 4.0 为.NET4中的System.dll、System.Xml.dll生成MOLE时发生编译错误

.net 4.0 为.NET4中的System.dll、System.Xml.dll生成MOLE时发生编译错误,.net-4.0,moles,.net 4.0,Moles,为.NET4 System.dll(build 4.0.30310.261)和System.Xml.dll(build 4.0.30319.233)生成MOLE时出现编译错误。System.Dll的错误有: m.g.cs(251449,33): error CS0115: 'System.Net.Moles.SFileWebResponse.Dispose(bool)': no suitable method found to override [c:\jin\moles\tmp\s\m.g.c

为.NET4 System.dll(build 4.0.30310.261)和System.Xml.dll(build 4.0.30319.233)生成MOLE时出现编译错误。System.Dll的错误有:

m.g.cs(251449,33): error CS0115: 'System.Net.Moles.SFileWebResponse.Dispose(bool)': no suitable method found to override [c:\jin\moles\tmp\s\m.g.csproj]
m.g.cs(251650,30): error CS0115: 'System.Net.Moles.SFileWebResponse.SupportsHeaders': no suitable method found to override [c:\jin\moles\tmp\s\m.g.csproj]
m.g.cs(255339,33): error CS0115: 'System.Net.Moles.SHttpWebResponse.Dispose(bool)': no suitable method found to override [c:\jin\moles\tmp\s\m.g.csproj]
m.g.cs(255540,30): error CS0115: 'System.Net.Moles.SHttpWebResponse.SupportsHeaders': no suitable method found to override [c:\jin\moles\tmp\s\m.g.csproj]
m.g.cs(303198,33): error CS0115: 'System.Net.Moles.SWebResponse.Dispose(bool)': no suitable method found to override [c:\jin\moles\tmp\s\m.g.csproj]
m.g.cs(303399,30): error CS0115: 'System.Net.Moles.SWebResponse.SupportsHeaders': no suitable method found to override [c:\jin\moles\tmp\s\m.g.csproj]
Done Building Project "c:\jin\moles\tmp\s\m.g.csproj" (default targets) -- FAILED.
System.Xml.Dll的错误有:

m.g.cs(113977,17): error CS0205: Cannot call an abstract base member: 'System.Xml.XmlReader.Close()' [c:\jin\moles\tmp\s\m.g.csproj]
m.g.cs(116149,21): error CS0205: Cannot call an abstract base member: 'System.Xml.XmlResolver.Credentials.set' [c:\jin\moles\tmp\s\m.g.csproj]
m.g.cs(130559,17): error CS0205: Cannot call an abstract base member: 'System.Xml.XmlWriter.Close()' [c:\jin\moles\tmp\s\m.g.csproj]
我在VS2010中使用摩尔数0.94。只有在安装.NET 4 service pack之后,这两个DLL的较新版本才会出现错误。在.NET 4 service Pack之前,这两个DLL的版本4.0.30319.1可以很好地生成MOLE

Moles生成的代码似乎与最新的.NET4程序集不兼容

查看以下问题:

基本上,更新System.moles如下:

<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
  <Assembly Name="System" ReflectionOnly="true"/>
</Moles>

查看以下问题:

基本上,更新System.moles如下:

<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
  <Assembly Name="System" ReflectionOnly="true"/>
</Moles>