【发布时间】:2026-01-03 15:50:02
【问题描述】:
我正在使用 VS2012 在 Sharepoint 2013 中开发一个 Web 部件。在这个 webpart 中,我使用了我创建的自定义 dll。库框架是 4.0,可视化 webpart 框架是 4.5。
问题是我在sharepoint页面添加webpart时,出现如下错误:
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) 使用 package ---> VS2012 解决方案资源管理器中的高级选项
当我在 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 中的保存控件
但是没有任何效果。有人知道为什么无法在共享点页面中添加我自己的 Web 部件吗?
【问题讨论】:
标签: visual-studio-2010 sharepoint-2010 visual-studio-2012 web-parts sharepoint-2013