I have recently installed application insights to my ASP.Net MVC 5
project, and it works as intended.
But when I run Update-Database
command to apply my migrations to database I get the following error: Couldn't find type for class Microsoft.ApplicationInsights.TraceListener.ApplicationInsightsTraceListener
.
The project on which I run Update-Database
is separate project ( class library ) which is included into web project.
Anyone knows how to fix this?
UPDATE: It works when I uninstall ApplicationInsightsTraceListener
nuget package, but it would be good if it can be fixed without uninstalling it.
When you run the migrations the entry point is the DbContext. It looks like you've not added the NuGet package for the ApplicationInsightsTraceListener to your Data Layer. Usually you only add the ApplicationInsights NuGet packages to the Web App and potentially your Console Applications/Web Jobs.
To get around this without installing the NuGet packages you can remove your Trace code from your DbContexts, also remember to remove them from the classes that your DbContexts relies upon. ..or just install the correct NuGet packages in the Data Layer too.
Regards..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With