Search code examples
visual-studio-2010dllsharepoint-2010itext

Why is a DLL referenced/used by my project not found at runtime?


I've added several iTextSharp DLLs to a Sharepoint 2010 project (deployed as a WebPart).

The Web Part compiles/runs fine (I can step through my WebPart project while interacting with the web part on a page on the Sharepoint site). That is, it runs fine until code is called that actually uses itextsharp.dll. Then, the page crashes, and I get (in the log file), "The system cannot find the file specified"

Do DLLs have to be deployed to a specific place for Sharepoint to find them, or...???

UPDATE

Even after copying four itextsharp DLLs to C:\Windows\Microsoft.NET (Windows Server 2008, .NET 3.5), I get the same err msg.

For the gory details from the log file:

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

Solution

  • The link provided by user2864740 was key.

    In a nutshell, this is what I did:

       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
    

    And: voila! Joy in Mudville, including a ticker-tape parade, a marching band featuring 76 trombones, and the whole nine yards (IOW, it worked).