Monday, March 26, 2007

C# Console App to Update Machine.config

I store proprietary information in our company's web servers' Machine.config's in order to manipulate the behavior of multiple applications. E.G., an appSetting determines whether the current machine is used for shared development, integration, pre-production testing, or production.

Unfortunately, I am not an administrator on the servers. No, we have outsourced that privilege to a vendor without accountability. Sound like an accident waiting to happen? That's a story for another day...

Anyway I can send a ticket to their help desk to have someone add the <appsettings> section if it doesn't exist, and then add my "Environment" key. But how do I trust that the person who picks up the ticket knows the first thing about where the appSettings section goes within Machine.config or its case-sensitive nature? I CAN'T.

The following is code for a console app that will update Machine.config according to your command line arguments:

Code snippet moved to my Windows Live Spaces Blog, for better readability.

2 comments:

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

site said...

This can't really work, I believe like this.