I just wanted to add to the answers already received, I just went through this process using the ASP.NET MVC 5 project.
Removing with NuGet
As the other answers say, the best way to remove Application Insights is through Nuget: Tools -> NuGet Package Manager -> Manage NuGet Packages for the solution.
I was better off uninstalling Microsoft.ApplicationInsights.Web and all its dependencies, and then the Microsoft.ApplicationInsights.Javascrtipt API .
This removed everything except:
- file ApplicationInsights.config,
- a script fragment in _Layout.cshtml,
both of which I deleted manually.
What Microsoft has to say
The Microsoft Azure documentation here: https://azure.microsoft.com/en-gb/documentation/articles/app-insights-troubleshoot-faq/ , says:
What will change Application Insights in my project?
Details depend on the type of project. For web application:
Adds these files to your project:
- ApplicationInsights.config.
- ai.js
Installs these NuGet packages:
- API Application Insights - the core API
- Application API for web applications - used to send telemetry from the server
- Application API for JavaScript applications - used to send telemetry from a client
Packages include these assemblies:
- Microsoft.ApplicationInsights
- Microsoft.ApplicationInsights.Platform
Inserts elements into:
- Web.config
- packages.config (only for new projects - if you add Application Insights to an existing project, you need to do it manually.) Insert code fragments of the client and server to initialize them using the Insights application resource identifier. For example, in an MVC application, code is inserted in the main page Views / Shared / _Layout.cshtml
Delete manually
To remove Insight Insight without NuGet, or, like me, you do not trust him and want to know which files are deleted, I performed the following steps:
Remove application information from web.config, under system.webserver.modules, find ApplicationInsightsWebTracking.
Remove all references to Microsoft.AI (Application Insights) from references to projects.
Remove all Microsoft.ApplicationInsights packages from package.config.
Delete the ApplicationInsights.config file.
Remove the script from _Layout.cshtml:
var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s=u.createElement(o),i,f;for(s.src=config.url||"//az416426.vo.msecnd.net/scripts/a/ai.0.js",u.getElementsByTagName(o)[0].parentNode.appendChild(s),t.cookie=u.cookie,t.queue=[],i=["Event","Exception","Metric","PageView","Trace"];i.length;)r("track"+i.pop());return r("setAuthenticatedUserContext"),r("clearAuthenticatedUserContext"),config.disableExceptionTracking||(i="onerror",r("_"+i),f=e[i],e[i]=function(config,r,u,e,o){var s=f&&f(config,r,u,e,o);return s!==!0&&t["_"+i](config,r,u,e,o),s}),t }({ instrumentationKey:"RemovedKey" }); window.appInsights=appInsights; appInsights.trackPageView();
Remove ai.0.15.0-build58334.js and ai.0.15.0-build58334.min.js from the Scripts directory.
Clean and rebuild everything.
Anthony May 17 '16 at 10:08 a.m. 2016-05-17 10:08
source share