Recently I was creating an Asp.Net web application for a SharePoint POC where we wanted to display SharePoint list data using CSOM (Client side object model using C#.Net), but I got an error as: Could not load file or assembly ‘Microsoft.AI.Web’ 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 ‘Microsoft.AI.Web’ or one of its dependencies. The system cannot find the file specified.
And the full error looks like below:
SharePoint Online tutorial contents:
Could not load file or assembly ‘Microsoft.AI.Web’ or one of its dependencies. The system cannot find the file specified.
Just to give a background, I was creating an asp.net application and add the Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.client.Runtime.dll from NuGet packages.
To resolve this you can add “Microsoft.ApplicationInsights.Web” dll from NuGet.
To do so, Right click on References inside Solution Explorer and click on “Manage NuGet Packages” like below:
And then you can search for “Microsoft.ApplicationInsights.Web” and then click on Install.
But in my case, the dll was already added. So I just need to update the dll. In the same NuGet manager,
Click on the Updates tab and select “Microsft.ApplicationInsights.Web” and then click on Update. This will update to the latest version.
Now the error “Could not load file or assembly ‘Microsoft.AI.Web’ or one of its dependencies. The system cannot find the file specified.” will not come.
Install Microsoft.ApplicationInsights.Web from NuGet Package Manager Console
There is another approach we can install Microsoft.ApplicationInsights.Web from NuGet Package Manager Console.
From Visual Studio 2017 click on Tools -> NuGet package manager -> Package Manager Console.
Then in the console write the below command,
and to install into a particular project then run the below command.
Install-Package Microsoft.ApplicationInsights.Web <ProjectName>
Once you click on Enter after writing the above command, it will install Microsoft.ApplicationInsights.Web and you will not get the error.
Update Microsoft.ApplicationInsights.Web from NuGet Package Manager Console
If you have already installed Microsoft.ApplicationInsights.Web and still you are getting the above error? Then you can update Microsoft.ApplicationInsights.Web from NuGet Package Manager Console.
Right click on Reference folder and then click on “Manage NuGet Packages…“, then you can search for “Microsoft.ApplicationInsights.Web” and there you can click on Update to the latest version like below:
The error can come in WCF services or windows applications or web applications. Every time you need to install Microsoft.ApplicationInsights.Web from NuGet Package Manager.
You can also check an error which comes in an asp.net application.
You may like following NuGet SharePoint PnP CSOM tutorials:
- SharePoint Online Development using Patterns and Practices (PnP)
- Get all Subsites in Site collection programmatically using PnP core CSOM Library in SharePoint Online/2016/2013
- After nine attempts there was a problem downloading the following file which is required to continue visual studio 2017
- SharePoint create workflow history list programmatically using client-side object model code (csom)
- The file is not checked out. You must first check out this document before making changes SharePoint 2013 CSOM
- You cannot change moderation status and set other item properties at that same time SharePoint online csom
- Rename SharePoint List Title Column Programmatically using PnP CSOM
I hope this tutorial will help to resolve the Could not load file or assembly ‘Microsoft.AI.Web or one of its dependencies. The system cannot find the file specified error.
Hello Everyone!! I am Bhawana a SharePoint MVP and having about 10+ years of SharePoint experience as well as in .Net technologies. I have worked in all the versions of SharePoint from wss to Office 365. I have good exposure in Customization and Migration using Nintex, Metalogix tools. Now exploring more in SharePoint 2016 🙂 Hope here I can contribute and share my knowledge to the fullest. As I believe “There is no wealth like knowledge and no poverty like ignorance”