Click here to Skip to main content
12,819,402 members (31,828 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 15 May 2014

Sharing Code that Uses Application Insights

, 15 May 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Sharing code that uses application insights

So you have a project that uses Application Insights and want to share it with the world. Sure, you just post it to CodePlex, GitHub or some other place that allows publishing of code, don't you.


Something that you don't want to do is share your code without removing some of the values under the ComponentSettings node in your ApplicationInsights.config. I see 3 possible ways of doing this, possibly each being used in a specific scenario.

1. Delete and Publish

When: I foresee this scenario being for when you have not made any custom changes to your Application Insights configuration.

The first way is to simply delete the Application.config and publish the source code.


This will mean that when somebody that downloads your code wants to run it and use the Application Insights bits, they will need to add new Application Insights configuration.


After they have done that, they can use your solution with Application Insights, no problem.

2. Blank Out or Token the ComponentSettings Section

When: I see this option being for when you have made modifications to the Application Insights config that you feel other users would need in order to effectively use App Insights in the application.

You could for example specify that for the Development Profile, you don't want the collection user and machine names.


The pieces you will want to blank out or token are below:

  • ComponentSettings\ComponentId
  • ComponentSettings\DevelopmentMode\ComponentId
  • ComponentSettings\DevelopmentMode\PortalURI
  • ComponentSettings\DevelopmentMode\DashboardId
  • ComponentSettings\AccountId
  • ComponentSettings\LicenseKey


After you have done this, you are good to share your code. Smile

3. Split Source Control

When: You want to share the code but also want to use the application for "real", i.e., Windows Store Application

What I have started doing for applications that I want to share the source for but also want to use the app in the real world is connecting to a public source control like CodePlex or GitHub and then also to private source control like VSO. The way I do it is to have a public GitHub repo that contains all the logic for my app, this repo is then pushed into a VSO repo as well where I do all my Application Insights stuff. Using this method allows me to work on my app normally as I would with source control and allows the community to be evolved as well with them having to worry about App Insights configuration (sometimes you would want them to be adding App Insights to the code as they add it in which case you will just keep the config separate) and then for when I publish to the store, I don't have to have to add a bunch of App Insights code everywhere and keep it out of source control. All I need to do is push to my VSO account, merge any conflicts (which shouldn't happen if I'm just doing App Insights in VSO) and then possibly add any additional telemetry that I want and then finally I publish to the store and everything is awesome Open-mouthed smile.


These are just my thoughts and there are probably other ways that people currently do it. One thing you don't want to do is share you keys because then you need to reset them and then update all applications in the wild connected to your account.

If you have other ways of handling this today, give me a shout at @GordonBeeming with some details. Smile


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Gordon Beeming (RSA)
Software Developer Derivco
South Africa South Africa
Gordon Beeming is a Software Developer at Derivco in the sunny city of Durban, South Africa. He spends most his time hacking away at the keyboard in Visual Studio or with his family relaxing. He is a Visual Studio ALM Rangers, Visual Studio ALM MVP and Friend of Red Gate. His blog is at and you can follow him on Twitter at

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170308.1 | Last Updated 15 May 2014
Article Copyright 2014 by Gordon Beeming (RSA)
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid