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.
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:
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.
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, click on Tools -> NuGet package manager -> 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>
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:
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:
- Datatables warning(table id = ‘example’): cannot reinitialise data table
- SharePoint Server relative urls must start with SPWeb.ServerRelativeUrl csom
- Column does not exist. it may have been deleted by another user error in SharePoint Online
- After nine attempts there was a problem downloading the following file which is required to continue visual studio
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”