How to Programmatically Modify the IIS Virtual Directory

If you have more than a dozen web servers in a cluster with identical setting, and you need to update the virtual directory, it is much more convenient to write a simple program to update it. This example shows how to do it. In this case, this snippet will change the physical path of a…


How to Create Custom Event Log for Windows Service

When you created a Windows Service, you usually add a Service Installer to allow this service to be installed using InstallUtil or installing it programmatically like this post shows you. The service installer will create the Event Log for the service, and by default it is "Application", and the source is the name of your…


How to Install Windows Service Programmatically

Sometimes you may want to install a Windows Service programmatically, but the target machine does not have InstallUtil.exe. To install a Windows Service programmatically, you can build an application to install that Windows Service. Add a reference to System.Configuration.Install Use this code: public static void InstallService(string ExeFilename) { System.Configuration.Install.AssemblyInstaller Installer = new System.Configuration.Install.AssemblyInstaller(ExeFilename); Installer.UseNewContext =…


How to Install Assemblies to the GAC Programmatically?

You can add or remove assemblies from the GAC using code. You can use Publish.GacInstall method to install an assembly to the GAC, or Publish.GacRemove method to remove that assembly from the GAC. If you are using Vista, and enable UAC, you have to run this code using elevated command (run as Administrator), otherwise it…

How to Find Out Which Column Caused SSIS to Fail?

In my previous post, I explained how you can find out the error description for the error id that is returned by SSIS. Of course, that information is only half helpful, debugging the issue also involve knowing which column caused that error. The Error Column returns an integer value which is also a little bit…


Switching Between Applications, Using Vista Flip3D

I like Flip3D, but I rarely use it, as I am accustomed switching between applications by pressing alt-tab. Using mouse to click that ‘switch between Windows’ is too slow. Did you know that you can activate Flip3D by pressing the Win key + tab? Switch the tab around by clicking either Win+Tab or Shift+Win+Tab.

How to Decipher/Understand SSIS Error Code?

If you have worked with SSIS, you may have been doing something like this, in case of errors, you saved the error code and the error column to a text file or some other media. If you get the error within the IDE, that is cool, as you can get more readable information, but if…


How to Convert a list of Object/String to an Array Using LINQ?

This is something that I really like, I can convert a list of objects into an array of something. I had a need to convert a list of string into an array of string, of course it can be done easily in several different ways, creating an array of int, converting the string element, and…


How to Build TFS Build Locally?

If you need to test your TFS build after playing around with the TFSBuild.proj, you can do that by do the following: Synchronize the source control to your workspace. Open Visual Studio 2005 Command Prompt (or Visual Studio 2008 Command Prompt), located under Start>Microsoft Visual Studio 2005>Visual Studio Tools. Change the directory into your TFSBuild.proj….


How to Make Sure InstallState Files Are Removed After Uninstall?

If you are building setup using Visual Studio and you have several custom actions and you noticed you see one or more .InstallState files in the target path after uninstall, most likely you have added your custom action to the Install custom action, but nothing else. What you should do is to add the same…