Could not load file or assembly '' or one of its dependencies

Imir Hoxha picture Imir Hoxha · Dec 6, 2011 · Viewed 105.9k times · Source

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

Answer

Oleg Savelyev picture Oleg Savelyev · Dec 8, 2011

To make Visual Studio adding 3rd party assembly or even your own assembly from other project in solution to GAC please do next:

  1. Open Package.package from Package folder in SharePoint project.

  2. Click Advanced in bottom area.

  3. Click Add and chose which type of assembly you want to add.

  4. In dialog select dll file, chec GAC or BIN, add safe controls and class resources entries if required. Click Ok.

Your assembly will be packaged to WSP, defined in manifest and deployed everytime.