[英]Could not load file or assembly '' or one of its dependencies
Any help please? 有什么帮助吗?
I have only one library and it is driving me crazy. 我只有一个图书馆,这让我发疯。 this is the error that I receive.
这是我收到的错误。 I am not using any other dependancies.
我没有使用任何其他依赖。
Could not load file or assembly 'FOD.Intranet.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=039c1f3a4c719e82' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'FOD.Intranet.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=039c1f3a4c719e82' or one of its dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'FOD.Intranet.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=039c1f3a4c719e82' or one of its dependencies. The system cannot find the file specified.]
NewCollection.VisualWebPart1.VisualWebPart1UserControl.TodaysNews() +0
NewCollection.VisualWebPart1.VisualWebPart1UserControl.Page_Load(Object sender, EventArgs e) +52
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.AddedControl(Control control, Int32 index) +350
NewCollection.VisualWebPart1.VisualWebPart1.CreateChildControls() +155
System.Web.UI.Control.EnsureChildControls() +146
System.Web.UI.Control.PreRenderRecursiveInternal() +61
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
To make Visual Studio adding 3rd party assembly or even your own assembly from other project in solution to GAC please do next: 要使Visual Studio从解决方案中的其他项目向GAC添加第三方程序集甚至您自己的程序集,请执行下一步:
Open Package.package from Package folder in SharePoint project. 从SharePoint项目中的Package文件夹中打开Package.package。
Click Advanced in bottom area. 单击底部区域中的“高级”
Click Add and chose which type of assembly you want to add. 单击“添加”,然后选择要添加的程序集类型。
In dialog select dll file, chec GAC or BIN, add safe controls and class resources entries if required. 在对话框中选择dll文件,chec GAC或BIN,如果需要,添加安全控件和类资源条目。 Click Ok.
单击确定。
Your assembly will be packaged to WSP, defined in manifest and deployed everytime. 您的程序集将打包到WSP,在清单中定义并每次部署。
Problem Solved! 问题解决了!
I thought that Visual Studio was copying the DLL in to the GAC, but apparently not. 我认为Visual Studio正在将DLL复制到GAC中,但显然不是。 So I copied it there manually and it works.
所以我手动复制它,它的工作原理。
One question though, is this normal that visual studio does not copy it to the GAC when I deploy the sharepoint application? 但有一个问题是,在部署sharepoint应用程序时,Visual Studio不会将其复制到GAC这是正常的吗?
For those who would like to know how to copy the dll to GAC 对于那些想知道如何将dll复制到GAC的人
there are two ways to copy the dll to GAC: 有两种方法可以将dll复制到GAC:
copy the dll manually 手动复制DLL
use VS to deploy it for you to GAC. 使用VS将其部署到GAC。
thank you for your support. 感谢您的支持。
If error is when publishing in Visual Studio 2012 un-check the "Precompile during publishing" option in the publish wizard and try again. 如果在Visual Studio 2012中发布时出错,请在发布向导中取消选中“发布期间预编译”选项,然后重试。
for guys still looking into this issue one thing u need to know is there are different GACutils out there , so u need to make sure that ur using correct GACUTIL to deploy the DLL to correct GAC 对于仍然在研究这个问题的人来说,你需要知道的是有一些不同的GACutils,所以你需要确保你使用正确的GACUTIL部署DLL来纠正GAC
for eg: if my dll was complied in 3.5 .net framework and my OS version was 64 bit windows it would be in below location 例如:如果我的dll符合3.5 .net框架,我的操作系统版本是64位窗口,它将在下面的位置
C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\x64 C:\\ Program Files(x86)\\ Microsoft SDKs \\ Windows \\ v7.0A \\ Bin \\ x64
Struggled for 4 stupid days to figure this out 苦苦挣扎了4个愚蠢的日子来解决这个问题
Please try to unreference the DLL then re reference it again and rebuild you project. 请尝试取消引用DLL然后再次引用它并重建项目。 Also Check to ensure that the version matchs what is in the project web config
还要检查以确保版本与项目Web配置中的版本匹配
Assuming that you have access to SharePoint server, try the following. 假设您有权访问SharePoint服务器,请尝试以下操作。 Some random thoughts and no specific order.
一些随机的想法,没有具体的顺序。
Are you developing your SharePoint project (do you mean web part?) using visual studio? 您是否正在使用visual studio开发SharePoint项目(您的意思是Web部件吗?)? Are you referencing it in your SharePoint project?
您是否在SharePoint项目中引用它? You need to give us more details on your development environment to be able to pinpoint the problem.
您需要向我们提供有关开发环境的更多详细信息,以便能够查明问题。
If you are using the code Page.Load("control_path..."). 如果您使用的是代码Page.Load(“control_path ...”)。 make sure that the actual ascx file you load does not have any directives that include the assembly from your exception message
确保您加载的实际ascx文件没有包含异常消息中的程序集的任何指令
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.