2011-05-12 28 views
3

我们具有下面的代码的问题:痣和SharePoint行为类型

 BSPSite site = new BSPSite(); 
     BSPWeb web = site.SetRootWeb(); 

错误是: 无法加载文件或程序集“System.Moles,版本= 4.0.0.0,Culture =非PublicKeyToken = 0ae41878053f6703'或它的一个依赖关系。该系统找不到指定的文件。

我们已经尝试在.NET 4的源代码中重建Behavoir程序集,但没有经过。我们正在使用v0.94。

任何帮助将不胜感激。

+0

没有任何版本的SharePoint支持.Net 4。 – 2011-05-13 04:33:51

回答

-1

删除所有.moles相关文件和.moles引用。

然后为每个组件添加Moles参考(右键单击References下的原始组件并选择Add Moles Reference)。这将使得新的Moles版本的.dll再生。

0

1)进入C:\ Program Files文件(x86)的\微软的Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies

2)找到Microsoft.Moles.VsHost.x86.exe.config

3 )通过在运行时添加下一行来打开并进行更改

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly> 
        <assemblyIdentity name="System.Moles" publicKeyToken="0ae41878053f6703" culture="neutral"/> 
        <bindingRedirect oldVersion= "4.0.0.0" 
               newVersion= "2.0.0.0"/> 
      </dependentAssembly> 

    </assemblyBinding>