Skip to content

Commit 4b5c8a0

Browse files
committed
reorder and Michael's comments
1 parent 3d2cbfb commit 4b5c8a0

File tree

1 file changed

+73
-66
lines changed

1 file changed

+73
-66
lines changed

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

Lines changed: 73 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,75 @@ 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-
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.
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 two ways 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.
14+
15+
## Uninstall using the Package Management Console
16+
17+
# [.NET](#tab/net)
18+
19+
1. To open the Package Management Console, in the top menu select Tools > NuGet Package Manager > Package Manager Console.
20+
21+
![In the top menu click Tools > NuGet Package Manager > Package Manager Console](./media/remove-application-insights/package-manager.png)
22+
1. Enter the following command: `Uninstall-Package Microsoft.ApplicationInsights.Web -RemoveDependencies`
23+
24+
After entering the command, the Application Insights package and all of its dependencies will be uninstalled from the project.
25+
26+
![Enter command in console](./media/remove-application-insights/package-management-console.png)
27+
28+
# [.NET Core](#tab/netcore)
29+
30+
1. To open the Package Management Console, in the top menu select Tools > NuGet Package Manager > Package Manager Console.
31+
32+
![In the top menu click Tools > NuGet Package Manager > Package Manager Console](./media/remove-application-insights/package-manager.png)
33+
34+
1. Enter the following command: ` Uninstall-Package Microsoft.ApplicationInsights.AspNetCore -RemoveDependencies`
35+
After entering the command, the Application Insights package and all of its dependencies will be uninstalled from the project
36+
37+
---
38+
39+
## Uninstall using the Visual Studio NuGet UI
40+
41+
# [.NET](#tab/net)
42+
43+
1. In the *Solution Explore* on the right, right click on **Solution** and select **Manage NuGet Packages for Solution**
44+
You'll then see a screen that allows you to edit all the NuGet packages that are part of the project.
45+
46+
![Right click Solution, in the Solution Explore, then select Manage NuGet Packages for Solution](./media/remove-application-insights/manage-nuget-framework.png)
47+
48+
1. Click on the "Microsoft.ApplicationInsights.Web" package. On the right, check the checkbox next to *Project* to select all projects.
49+
50+
1. To remove all dependencies when uninstalling, select the **Options** dropdown button below the section where you selected project.
51+
52+
Under *Uninstall Options*, select the checkbox next to *Remove dependencies*.
53+
54+
1. Select **Uninstall**
55+
56+
![Check remove dependencies, then uninstall](./media/remove-application-insights/uninstall-framework.png)
57+
58+
A dialog box will display that shows all of the dependencies to be removed from the application. Select **ok** to remove them.
59+
60+
![Check remove dependencies, then uninstall](./media/remove-application-insights/preview-uninstall-framework.png)
61+
62+
1. After everything is uninstalled, you may still see  "ApplicationInsights.config" and "AiHandleErrorAttribute.cs" in the *Solution Explore*. You can delete the two files manually.
63+
64+
# [.NET Core](#tab/netcore)
65+
66+
1. In the *Solution Explore* on the right, right click on **Solution** and select **Manage NuGet Packages for Solution**
67+
68+
You'll then see a screen that allows you to edit all the NuGet packages that are part of the project.
69+
70+
![Right click Solution, in the Solution Explore, then select Manage NuGet Packages for Solution](./media/remove-application-insights/manage-nuget-core.png)
71+
72+
1. Click on "Microsoft.ApplicationInsights.AspNetCore" package. On the right, check the checkbox next to *Project* to select all projects then select **Uninstall**.
73+
74+
![Check remove dependencies, then uninstall](./media/remove-application-insights/uninstall-core.png)
75+
76+
---
1477

1578
## What is created when you add Application Insights
1679

80+
When you add Application Insights to your project it creates files and adds code to some of your files. Only removing the NuGet Packages won't always remove these files and code. To fully remove Application Insights you should check and manually remove the added code or files from you projects along with any API calls you added in your project.
81+
1782
# [.NET](#tab/net)
1883

1984
When you add Application Insights Telemetry to a Visual Studio ASP.NET template project, it adds the following files:
@@ -23,7 +88,7 @@ When you add Application Insights Telemetry to a Visual Studio ASP.NET template
2388

2489
The following pieces of code are added:
2590

26-
- [Your project's name].vbproj
91+
- [Your project's name].csproj
2792

2893
```C#
2994
<ApplicationInsightsResourceId>/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/Default-ApplicationInsights-EastUS/providers/microsoft.insights/components/WebApplication4</ApplicationInsightsResourceId>
@@ -56,6 +121,8 @@ The following pieces of code are added:
56121

57122
- Layout.cshtml
58123

124+
If your project has a Layout.cshtml file the code below is added.
125+
59126
```html
60127
<head>
61128
...
@@ -89,7 +156,7 @@ The following pieces of code are added:
89156

90157
- FilterConfig.cs
91158

92-
```C#
159+
```csharp
93160
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
94161
{
95162
filters.Add(new ErrorHandler.AiHandleErrorAttribute());// This line was added
@@ -102,7 +169,7 @@ When you add Application Insights Telemetry to a Visual Studio ASP.NET Core temp
102169

103170
- [Your project's name].csproj
104171

105-
```C#
172+
```csharp
106173
<PropertyGroup>
107174
<TargetFramework>netcoreapp3.1</TargetFramework>
108175
<ApplicationInsightsResourceId>/subscriptions/b21990e9-15a7-47eb-9ad0-f6b7155ab349/resourcegroups/Default-ApplicationInsights-EastUS/providers/microsoft.insights/components/WebApplication4core</ApplicationInsightsResourceId>
@@ -116,6 +183,7 @@ When you add Application Insights Telemetry to a Visual Studio ASP.NET Core temp
116183
<WCFMetadata Include="Connected Services" />
117184
</ItemGroup>
118185
```
186+
119187
- Appsettings.json:
120188

121189
```json
@@ -136,7 +204,7 @@ When you add Application Insights Telemetry to a Visual Studio ASP.NET Core temp
136204
```
137205
- Startup.cs
138206

139-
```C#
207+
```csharp
140208
public void ConfigureServices(IServiceCollection services)
141209
{
142210
services.AddRazorPages();
@@ -146,67 +214,6 @@ When you add Application Insights Telemetry to a Visual Studio ASP.NET Core temp
146214

147215
---
148216

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)
161-
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.
165-
166-
1. Enter the following command: ` Uninstall-Package Microsoft.ApplicationInsights.AspNetCore -RemoveDependencies`
167-
After entering the commandthe Application Insights package and all of its dependencies will be uninstalled from the project
168-
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)
197-
198-
1. In the *Solution Explore* on the rightright click on **Solution** and select **Manage NuGet Packages for Solution*
199-
200-
You'll then see a screen that allows you to edit all the NuGet packages that are part of the project.
201-
202-
![Right click Solutionin the Solution Explorethen select Manage NuGet Packages for Solution](./media/remove-application-insights/manage-nuget-core.png)
203-
204-
1. Click on "Microsoft.ApplicationInsights.AspNetCore" package. On the right, check the checkbox next to **Project** to select all projects.
205-
206-
![Check remove dependencies, then uninstall](./media/remove-application-insights/uninstall-core.png)
207-
208-
---
209-
210217
## Troubleshooting
211218

212219
# [.NET](#tab/net)

0 commit comments

Comments
 (0)