Visual studio 2010 添加Web部件时出错

Visual studio 2010 添加Web部件时出错,visual-studio-2010,sharepoint-2010,visual-studio-2012,web-parts,sharepoint-2013,Visual Studio 2010,Sharepoint 2010,Visual Studio 2012,Web Parts,Sharepoint 2013,我正在Sharepoint 2013中使用VS2012开发一个Web部件。在这个Web部件中,我正在使用我创建的自定义dll。库框架为4.0,可视化Web部件框架为4.5 问题是,当我在sharepoint页面中添加Web部件时,出现以下错误: Could not load file or assembly 'RulesDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d2371e81bc184aa5' or one of its dep

我正在Sharepoint 2013中使用VS2012开发一个Web部件。在这个Web部件中,我正在使用我创建的自定义dll。库框架为4.0,可视化Web部件框架为4.5

问题是,当我在sharepoint页面中添加Web部件时,出现以下错误:

Could not load file or assembly 'RulesDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d2371e81bc184aa5' or one of its dependencies. The system cannot find the file specified
在谷歌搜索,我找到了很多解决这个问题的方法

  • 使用两种方法将库添加到GAC

    (1) gacutil-i RulesDll.dll

    (2) 在VS2012的解决方案资源管理器中使用package-->Advanced options

当我在VS命令提示符下运行gacutil-l RulesDll时,一切正常:

Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.17929
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  RulesDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d2371e81bc184aa5,    processorArchitecture=x86
项目数量=1

所以图书馆在GAC里

  • 将库添加到web.config中的save控件

但什么都不管用。有人知道为什么无法在sharepoint页面中添加我自己的Web部件吗?

当程序集位于GAC中并且您尝试在页面上添加Web部件时,会出现什么错误

检查应用程序的web.config,尤其是SafeControls部分,应该有对程序集的引用


终于找到了错误。所有库都必须在x64中部署