16
votes

I have an existing Web Project. I clicked "Add Application Insights Telemetry to Project" and at one point in the process it threw an error like '[...] failed to initialize the powershell host [...]'. Then I tried a few things according to Google searches. There is no ApplicationInsights.config in the project, nor is the Microsoft.ApplicationInsights.Telemetry.Services referenced.

Now there is no 'Add Application Insights Telemetry to Project' option to be found anywhere. I even tried to re-install the Application Insights extension.

I tried to roll back any changes via git, but without luck.

Non of my teammates see the 'Add Application Insights Telemetry to Project' option in VS. (We're all using Visual Studio Ultimate 2013 Update 4)

In case I can't get this to work, is there a way to manually set this up?

2
what version of the app insights extension are you using? if you uninstalled it from update 4, and installed the one from the extension gallery, you installed a different (old, visual studio online) based version of the vsix. The one installed in the box in update 4 is new, and based on the new azure portal version of application insights. The error you had above is a random nuget installer error, usually you can just try to add AI again and it should work... If you did install the one from the gallery, i'd suggest uninstalling it, and repairing visual studio to get the "new" one back.John Gardner
you'll only see the "Add Application Insights..." option for (1) projects that don't already have it (applicationinsights.config) and (2) are ones we support. what kind of web project is it? is it a "web site" project? because that we don't support.John Gardner
If you are working with .Net Core project you should use a slightly different approach, well defined here: .Net Core Application Insights tutorialhenioStraszny

2 Answers

10
votes

Manually, you can add the nuget package yourself (the web one is: http://www.nuget.org/packages/Microsoft.ApplicationInsights.Web)

and then manually create an application insights resource on the Azure portal (http://portal.azure.com), and then take the instrumentation key for your new resource, and paste it into the ApplicationInsights.config file that the nuget package installed into your project.

The AI VSIX adds a GUI on top of those steps. (can help you fix whatever's wrong with the vsix i'd rather have you do that first, though!)

0
votes

I found that this was related to the ProjectTypeGuids being missing from my csproj files.

In VS2015 the following ProjectTypeGuids needed to be present:

<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>