Tuesday, January 8, 2013

File not found exception in Office 2010 addin / ClientContext Code not executing

When we add any reference dlls(say in the example Microsoft.SharePoint.Client dll)  in Office 2010 addin and package it using Click once and install it in client machine it gives an


System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SharePoint.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

File name: 'Microsoft.SharePoint.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

   at WordAddIn1.Form1.UploadDocument(Byte[] docbytes)

   at WordAddIn1.Form1.button1_Click(Object sender, EventArgs e)



Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

Running under executable  C:\PROGRA~1\MICROS~2\Office14\WINWORD.EXE

Fix:


Add the reference dlls in the root of the project like below and publish again. This took me a day to figure out :(.

There were no good article to debug and fix this issue in msdn forums so thought this might be useful to someone

2 comments:

  1. Hi, Very nice description about SharePoint Solutions.
    I like your web blog.Because whenever i come into your web blog
    then i always get the new interesting and important information in your web blog.

    Thank You

    SharePoint Solutions

    ReplyDelete