2

I wrote a utility in C# to copy files from a network directory to a SharePoint document library. When the sys admin tries to run the .exe from a non-SharePoint server, he gets the following error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SharePoint.Client, Vers ion=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the f ile specified. File name: 'Microsoft.SharePoint.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' at SpFileUpload.Program.Main()

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Is there a way to include the assembly in my .exe so that it will run properly?

Edit: I'm using the SharePoint 2010 Client Object Model.

1

Instructions on how to deploy the SharePoint 2010 Client Object Model assemblies can be found in Client Object Model Distribution and Deployment

Microsoft SharePoint Foundation 2010 installs Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\ISAPI for easy access in development. You must have both Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll to develop a solution remotely with the .NET managed object model. For a Windows Forms, Windows Presentation Foundation (WPF), or other application that calls the .NET managed SharePoint Foundation client APIs, to function, the client computer must have the SharePoint Foundation client DLLs installed. The client DLLs must be distributed with the application by using Microsoft's SharePoint Foundation 2010 Client Object Model Redistributable.

  • Does that mean that the server admin has to install the Client Object Model redistributable on the server? – LFurness Dec 12 '13 at 19:35
  • 1
    Yes. Running the install will deploy the .NET assemblies that implement the SharePoint 2010 Client Object Model (specifically Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll) – Rob Windsor Dec 12 '13 at 19:43
  • If you are adding these DLLs using NuGet packages in your project/Application, there is no need for the System Admin to install a redistributable in his server. These DLLs will be included in your project/application as a package wherever you deploy the application, application will work fine. I think that is the beauty of NuGet packages. Don't you agree Rob? Why you need to depend on the System Admin to get your stuff working? – Biju Joseph - MCSD Dec 13 '13 at 4:04
  • Make sure Copy Local is set to true if you inspect the properties of your Sharepoint dll's. – Danny Bullis Apr 27 '15 at 19:39
2

Please Use NuGet Package Manager to add DLLs to your projectenter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.