为什么在运行时找不到我的项目引用/使用的DLL?

时间:2015-03-30 21:07:17

标签: visual-studio-2010 dll sharepoint-2010 itextsharp

我已将几个iTextSharp DLL添加到Sharepoint 2010项目(部署为WebPart)。

Web部件编译/运行正常(我可以在与Sharepoint站点上的页面上的Web部件交互时单步执行我的WebPart项目)。也就是说,它运行正常,直到调用实际使用itextsharp.dll的代码。然后,页面崩溃,我得到(在日志文件中),“系统找不到指定的文件”

必须将DLL部署到Sharepoint的特定位置才能找到它们,或者...... ???

更新

即使将四个itextsharp DLL复制到C:\ Windows \ Microsoft.NET(Windows Server 2008,.NET 3.5)之后,我也会得到相同的错误信息。

对于日志文件中的血腥细节:

03/30/2015 14:49:28.43  w3wp.exe (0x0968)                           0x1834  SharePoint Foundation           Runtime                         tkau    Unexpected  System.IO.FileNotFoundException: Could not load file or assembly 'itextsharp, Version=5.5.5.0, Culture=neutral, PublicKeyToken=6574839201' or one of its dependencies. The system cannot find the file specified.    at XMLToPDF.XMLToPDFWebPart.XMLToPDFWebPart.ConvertFromXMLToPDF(List`1 listOfListItems)     at XMLToPDF.XMLToPDFWebPart.XMLToPDFWebPart.btnSave_Click(Object sender, EventArgs e)     at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ef8cece3-42f4-47d0-ab0a-ca2f0fff46e4

1 个答案:

答案 0 :(得分:0)

link provided by user2864740是关键。

简而言之,这就是我所做的:

   2-clicked Package.package
   Selected the "Advanced" button
   Selected the "Add" > "Add Existing Assembly" button
   Verified "GlobalAssemblyCache" was selected
   Using the ellipsis button affiliated with the "Source Path" edit, added each needed DLL one at a time
   Saved Package.package

而且:瞧!在Mudville的欢乐,包括一个自动收录机游行队伍,一个拥有76个长号的游行乐队,以及整个九码(IOW,它起作用)。