Skip to content

Commit a688de7

Browse files
committed
tabs, troubeshoot section, etc
1 parent cbdb311 commit a688de7

File tree

4 files changed

+85
-49
lines changed

4 files changed

+85
-49
lines changed
8.88 KB
Loading
14.8 KB
Loading
23.2 KB
Loading

articles/azure-monitor/app/remove-application-insights.md

Lines changed: 85 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ ms.date: 03/25/2020
1010

1111
This article will show you how to remove the ASP.NET and ASP.NET Core Application Insights SDK in Visual Studio.
1212

13-
## ASP.NET
13+
To remove Application Insights, you'll need to remove the NuGet packages and references from the API in your application. You can remove NuGet packages by using the Package Management Console or Manage NuGet Solution in Visual Studio. The following sections will show you how to remove NuGet Packages and what was automatically added in your project. Be sure to confirm the files added and areas with in your own code in which you made calls to the API are removed.
1414

15-
To remove Application Insights, you'll need to remove the NuGet packages and references from the API in your application.
15+
## What is created when you add Application Insights
1616

17-
You can remove ASP.NET NuGet packages by using the Package Management Console or Manage NuGet Solution in Visual Studio. The following sections will show you how to remove NuGet Packages and what was automatically added in your project. Be sure to confirm the files added and areas with in your own code in which you made calls to the API are removed.
18-
19-
### ASP.NET: What is created when you add Application Insights
17+
# [.NET](#tab/net)
2018

2119
When you add Application Insights Telemetry to a Visual Studio ASP.NET template project, it adds the following files:
2220

@@ -98,47 +96,7 @@ The following pieces of code are added:
9896
}
9997
```
10098

101-
### ASP.NET: Using the Package Management Console
102-
103-
1. To open the Package Management Console, in the top menu select Tools > NuGet Package Manager > Package Manager Console.
104-
105-
![In the top menu click Tools > NuGet Package Manager > Package Manager Console](./media/remove-application-insights/package-manager.png)
106-
1. Enter the following command: `Uninstall-Package Microsoft.ApplicationInsights.Web -RemoveDependencies`
107-
108-
After entering the command, the Application Insights package and all of its dependencies will be uninstalled from the project.
109-
110-
![Enter command in console](./media/remove-application-insights/package-management-console.png)
111-
112-
### ASP.NET: Using the Visual Studio NuGet UI
113-
114-
1. In the *Solution Explore* on the right, right click on **Solution** and select **Manage NuGet Packages for Solution**
115-
You'll then see a screen that allows you to edit all the NuGet packages that are part of the project.
116-
117-
![Right click Solution,in the Solution Explore, then select Manage NuGet Packages for Solution](./media/remove-application-insights/manage-nuget-framework.png)
118-
119-
1. Click on the "Microsoft.ApplicationInsights.Web" package. On the right, check the checkbox next to **Project** to select all projects.
120-
121-
1. To remove all dependencies when uninstalling, select the **Options** dropdown button below the section where you selected project.
122-
123-
Under *Uninstall Options*, select the checkbox next to *Remove dependencies*.
124-
125-
1. Select Uninstall
126-
127-
![Check remove dependencies, then uninstall](./media/remove-application-insights/uninstall-framework.png)
128-
129-
A dialog box will display that shows all of the dependencies to be removed from the application. Select **ok** to remove them.
130-
131-
![Check remove dependencies, then uninstall](./media/remove-application-insights/preview-uninstall-framework.png)
132-
133-
1. After everything is uninstalled, you may still see  "ApplicationInsights.config" and "AiHandleErrorAttribute.vb" in the *Solution Explore*. You can delete the two files manually.
134-
135-
## ASP.NET Core
136-
137-
To remove Application Insights, you'll need to remove the NuGet packages and references from the API in your application.
138-
139-
You can remove ASP.NET Core NuGet packages by using the Package Management Console or Manage NuGet Solution in Visual Studio. The following sections will show you how to remove NuGet Packages and what was automatically added in your project. Be sure to confirm the files added and areas with in your own code in which you made calls to the API are removed.
140-
141-
### ASP.NET Core: What is created when you add Application Insights
99+
# [.NET Core](#tab/netcore)
142100

143101
When you add Application Insights Telemetry to a Visual Studio ASP.NET Core template project, it adds the following code:
144102

@@ -186,14 +144,56 @@ When you add Application Insights Telemetry to a Visual Studio ASP.NET Core temp
186144
}
187145
```
188146

189-
### ASP.NET Core: Using the Package Management Console
147+
---
148+
149+
## Uninstall using the Package Management Console
150+
151+
# [.NET](#tab/net)
152+
153+
1. To open the Package Management Consolein the top menu select Tools > NuGet Package Manager > Package Manager Console.
154+
155+
![In the top menu click Tools > NuGet Package Manager > Package Manager Console](./media/remove-application-insights/package-manager.png)
156+
1. Enter the following command: `Uninstall-Package Microsoft.ApplicationInsights.Web -RemoveDependencies`
157+
158+
After entering the commandthe Application Insights package and all of its dependencies will be uninstalled from the project.
159+
160+
![Enter command in console](./media/remove-application-insights/package-management-console.png)
190161

191-
1. To open the Package Management Consolein the top menu select Tools > NuGet Package Manager > Package Manager Console.
162+
# [.NET Core](#tab/netcore)
163+
164+
1. To open the Package Management Consolein the top menu select Tools > NuGet Package Manager > Package Manager Console.
192165

193166
1. Enter the following command: ` Uninstall-Package Microsoft.ApplicationInsights.AspNetCore -RemoveDependencies`
194167
After entering the commandthe Application Insights package and all of its dependencies will be uninstalled from the project
195168

196-
### ASP.NET Core: Using the Visual Studio NuGet UI
169+
---
170+
171+
## Uninstall using the Visual Studio NuGet UI
172+
173+
# [.NET](#tab/net)
174+
175+
1. In the *Solution Explore* on the rightright click on **Solution** and select **Manage NuGet Packages for Solution**
176+
You'll then see a screen that allows you to edit all the NuGet packages that are part of the project.
177+
178+
![Right click Solution, in the Solution Explorethen select Manage NuGet Packages for Solution](./media/remove-application-insights/manage-nuget-framework.png)
179+
180+
1. Click on the "Microsoft.ApplicationInsights.Web" packageOn the rightcheck the checkbox next to **Project** to select all projects.
181+
182+
1. To remove all dependencies when uninstallingselect the **Options** dropdown button below the section where you selected project.
183+
184+
Under *Uninstall Options*select the checkbox next to *Remove dependencies*.
185+
186+
1. Select Uninstall
187+
188+
![Check remove dependencies, then uninstall](./media/remove-application-insights/uninstall-framework.png)
189+
190+
A dialog box will display that shows all of the dependencies to be removed from the applicationSelect **ok** to remove them.
191+
192+
![Check remove dependencies, then uninstall](./media/remove-application-insights/preview-uninstall-framework.png)
193+
194+
1. After everything is uninstalledyou may still see  "ApplicationInsights.config" and "AiHandleErrorAttribute.vb" in the *Solution Explore*You can delete the two files manually.
195+
196+
# [.NET Core](#tab/.netcore)
197197

198198
1. In the *Solution Explore* on the rightright click on **Solution** and select **Manage NuGet Packages for Solution*
199199

@@ -205,6 +205,42 @@ When you add Application Insights Telemetry to a Visual Studio ASP.NET Core temp
205205

206206
![Check remove dependencies, then uninstall](./media/remove-application-insights/uninstall-core.png)
207207

208+
---
209+
210+
## Troubleshotting
211+
212+
# [.NET](#tab/net)
213+
214+
- Unable to install because another NuGet packages depends on it error.
215+
216+
You will need to uninstall the NuGet package or packages that depend on "Microsoft.ApplicationInsights.Web" first. If you have multiple packages that depend on each other, you need to start with the package that nothing depends on first.
217+
218+
For example, if you have trace collection enabled you may receive an error like the one below when uninstalling Microsoft.ApplicationInsights.Web.
219+
220+
![Error of being able to uninstall Microsoft.ApplicationInsights.Web because Microsoft.ApplicationInsights.TraceListener depends on it ](/media/remove-application-insights/uninstall-error1.png)
221+
222+
If that is case you will first uninstall the "Microsoft.ApplicationInsights.TraceListener" package, and then try uninstalling the "Microsoft.ApplicationInsights.Web" again.
223+
224+
If you end up with another error that you can't uninstall "Microsoft.ApplicationInsights.TraceListener" because another package or packages depend on it you can look through those packages and find one that doesn't does not depend on anything to be uninstalled first.
225+
226+
![Error of being able to uninstall Microsoft.ApplicationInsights.TraceListener because Microsoft.ApplicationInsights.Dependency Collector, Microsoft.ApplicationInsights.PerfCounterCollector, and Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel all depend on Microsoft.ApplicationInsights.WindowsServer depends on it](/media/remove-application-insights/uninstall-error2.png)
227+
228+
However in this case Microsoft.ApplicationInsights.Dependency Collector, Microsoft.ApplicationInsights.PerfCounterCollector, and Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel all depend on Microsoft.ApplicationInsights.WindowsServer but Microsoft.ApplicationInsights.WindowsServer depends on Microsoft.ApplicationInsights.Web.
229+
230+
Go back to uninstall Microsoft.ApplicationInsights.Web but this time in *Uninstall Options* select "Force uninstall even if there are dependencies on it" ("Remove dependencies" should still be selected). This will uninstall the package even if it's still being referenced in the project. This option could lead to broken reference in your project; if that happens you make need to [reinstall](https://docs.microsoft.com/nuget/consume-packages/reinstalling-and-updating-packages) those other packages. Then uninstall "Microsoft.ApplicationInsights.TraceListener".
231+
232+
![Select force uninstall](/media/remove-application-insights/force-uninstall.png)
233+
234+
- How to uninstall Microsoft.ApplicationInsights.TraceListener
235+
236+
If you would like to only uninstall Microsoft.ApplicationInsights.TraceListener, follow the steps in "Unable to uninstall because another NuGet package depends on it error" but instead force uninstalling Microsoft.ApplicationInsights.Web, force uninstall "Microsoft.ApplicationInsights.TraceListener".
237+
238+
-
239+
240+
# [.NET Core](#tab/netcore)
241+
242+
---
243+
208244
## Next Steps
209245

210246
- [Azure Monitor](https://docs.microsoft.com/azure/azure-monitor/overview)

0 commit comments

Comments
 (0)