Could not load file or assembly ‘Microsoft.AI.Web’ or one of its dependencies. The system cannot find the file specified.

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.

The full error looks like the below:

Could not load file or assembly ‘Microsoft.AI.Web’ or one of its dependencies. The system cannot find the file specified.

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 the “Microsoft.ApplicationInsights.Web” dll from NuGet.

To do so, Right click on References inside Solution Explorer and click on “Manage NuGet Packages” like below:

could not load file or assembly 'microsoft.ai.web' or one of its dependencies

Then, you can search for “Microsoft.ApplicationInsights.Web” and then click on Install.

But in my case, the dll was already added. So, I need to update the dll. In the same NuGet manager,

Click on the Updates tab, select “Microsft.ApplicationInsights.Web” and then click on Update. This will be updated to the latest version.

Could not load file or assembly Microsoft.AI.Web or one of its dependencies

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.

See also  JavaScript Object Model (JSOM) in SharePoint Online - JSOM in SharePoint

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, click on Tools -> NuGet package manager -> Package Manager Console.

Install Microsoft.ApplicationInsights.Web from NuGet Package Manager Console

Then, in the console, write the below command,

Install-Package Microsoft.ApplicationInsights.Web

To install it into a particular project, then run the below command.

Install-Package Microsoft.ApplicationInsights.Web <ProjectName>
Install Microsoft.ApplicationInsights.Web from NuGet Package Manager Console

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

Suppose 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 the 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:

Could not load file or assembly ‘Microsoft.AI.Web’ or one of its dependencies

The error can come in WCF services, windows applications, or web applications. Every time you need to install Microsoft.ApplicationInsights.Web from NuGet Package Manager.

You can also check an error that comes in an asp.net application.

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.

You may like the following errors:

>