System.IO.FileNotFoundException

During the deployment of a solution to my test environment I got the following error:

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

at triad.customer.intranet.Features.CGFixNewCaseLibrary.CGFixNewCaseLibraryEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)

at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)

at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce)

at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly)

at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, Int32 compatibilityLevel, String featureName, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly, Boolean fIgnoreMissing, SPFeatureDefinitionScope featdefScope)

at Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedCore(SPSite site, SPWeb web, String sFeatures, Boolean fMarkOnly, Boolean fIgnoreMissing)

at Microsoft.SharePoint.SPFeatureManager.<>c__DisplayClass7.<EnsureFeaturesActivatedAtWeb>b__6()

at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)

at Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedAtWeb(Byte[]& userToken, Guid& tranLockerId, Int32 nZone, Guid databaseid, Guid siteid, Guid webid, String sFeatures, Boolean fIgnoreMissing)

at Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String& bstrWebTemplate, Int32& plWebTemplateId)

at Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String& bstrWebTemplate, Int32& plWebTemplateId)

at Microsoft.SharePoint.SPWeb.ProvisionWebTemplate(SPWebTemplate webTemplate, String webTemplateToUse, SPFeatureWebTemplate featureWebTemplate, Page page, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1& featureDependencyErrors)

at Microsoft.SharePoint.SPWeb.ApplyWebTemplate(SPWebTemplate webTemplate, Page page, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1& featureDependencyErrors)

at Microsoft.SharePoint.ApplicationPages.TemplatePickerUtil.ApplyWebTemplateAndRedirect(SPWeb Web, String strWebTemplate, Nullable`1 bSharedNav, Boolean bOnTopNav, Boolean bOnQuickLaunch, Page page, Boolean bDeleteOnError, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1& featureDependencyErrors)

at Microsoft.SharePoint.ApplicationPages.NewSubwebPage.BtnCreateSubweb_Click(Object sender, EventArgs e)

at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

My solution uses Workflow Manager 1.0 based workflows created in SharePoint Designer.

So I needed to register Microsoft.SharePoint.Client.WorkflowServices.dll

That’s easy …

Solving the Could not load file or assembly

First I took a copy of my GacUtil from my development environment. Visual Studio is installed o this machine so GacUtil is available. In production and test environments this will not be the case

in the C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools    I found:

  • gacutil.exe
  • gacutil.exe
  • 1033\gacutlrc.dll

I copied these 3 files and a folder to my test environment

then the following commands (running the command prompt as in  Administrator mode):

C:\Users\myaccount\Downloads\GU\GU>gacutil -i “C:\Program Files\Common Files\Mi
crosoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.18020
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

C:\Users\myaccount\Downloads\GU\GU>gacutil -i “C:\Program Files\Common Files\Mi
crosoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtim
e.dll”
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.18020
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

C:\Users\myaccount\Downloads\GU\GU>gacutil -i “C:\Program Files\Common Files\Mi
crosoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Workfl
owServices.dll”
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.18020
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

All the required dlls are now registered and the redeployment of the solution and creation of the site now worked

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

One thought on “SharePoint 2013 – System.IO.FileNotFoundException: Could not load file or assembly”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading