IIS Express Webserver Here – Shell Extension

If you have installed mono, mono comes with a web server called XSP. One of my favorite feature of XSP (or mono) is you can right click on any folder and start a website with that folder as the physical path. And if you are downloading lot of sample code and application; every time hosting the application in IIS is a tedious job. Here is a simple Windows Explorer shell extension, which will help you to right click on a folder and Start IIS express (IIS Express, a lightweight version of IIS, is available as a standalone freeware server and may be installed on Windows XP with Service Pack 3 and subsequent versions of Microsoft Windows. IIS 7.5 Express supports only the HTTP and HTTPS protocols. IIS Express can be downloaded separately or as a part of Microsoft WebMatrix.).

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\folder\shell\IISExpressHere]
@="IIS Express Webserver Here"
[HKEY_CURRENT_USER\Software\Classes\folder\shell\IISExpressHere\command]
@="cmd /c start /D\"C:\\Program Files\\IIS Express\\\" iisexpress.exe /port:%%random%% /path:\"%1\""

Code Explained

Line #1- Registry Editor Version – RegistryEditorVersion is either “Windows Registry Editor Version 5.00″ for Windows 2000, Windows XP, and Windows Server 2003, or “REGEDIT4″ for Windows 98 and Windows NT 4.0. The “REGEDIT4″ header also works on Windows 2000-based, Windows XP-based, and Windows Server 2003-based computers.
Line #2, #3- This will create a context menu item with text – “IIS Express Webserver Here”
Line #4 – This will associate a command to the above created menu item.
Line #5 – Start IISExpress.exe from the location, with a Random port (%RANDOM% – will return a random number). And %1 will be the selected folder.

Create a file with “.reg” extension, copy paste the code and save. Double click on the reg file. You may get UAC dialog and a security warning from Registry editor. Once you successfully merged the changes, you will get a context menu item like this, which will start IIS Express.

IIS Express Webserver Here - Shell Extension

My Environment is Windows 7 x64 bit system. Please modify the script according to your environment.

Caution: Incorrectly editing the registry may severely damage your system. Back up the current version of the registry before making any changes. You should also back up any valued data on the computer.

How to uninstall Internet Explorer 9

Due to some VPN connectivity issues, today I had to rollback my IE installation, and I couldn’t find it in the control panel, Add or remove programs. I deselected the check box in Windows Programs and Features dialog, but it removed the Internet explorer from my computer. Later I found the solution in Microsoft website. These are steps required to uninstall IE9.

  • Open Programs and Features from Control Panel.
  • Select View Installed Updates from left side
  • Under Uninstall an update, scroll down to the Microsoft Windows section
  • Right-click Windows Internet Explorer 9, click Uninstall, and then, when prompted, click Yes. And restart the computer. It will un-install IE9 and install IE8.

Happy Coding :)

How to add Tasks to Jumplists in .NET and Windows 7

Windows 7 provides a new taskbar feature for applications called Jumplists. Jumplists will appear, when user right-clicks on a application icon in the taskbar. By default you see a list of recent files opened and two entries to launch and detach the application.

.NET 4.0 provides a managed API that allows you to easily manipulate the entries in the jumplist. A jumplist is list of links to files that can be launched by the user. The links are called JumpTasks. They can be parametrized with a title, description, icon, filepath and command line arguments.

Here is sample implementation, which will show a jumplist item, like this

Custom jumplist items

Custom jumplist items

Here is the code snippet which will create the Jumplists for the application.

protected override void OnStartup(StartupEventArgs e)
{
    var firefoxTask = new JumpTask()
    {
        ApplicationPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe",
        Title = "Open in Firefox",
        Description = "Open in Firefox",
        Arguments = "http://www.dotnetthoughts.net",
        CustomCategory = "Actions",
        IconResourcePath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe",
        IconResourceIndex = 0
    };

    var ieTask = new JumpTask()
    {
        ApplicationPath = @"C:\Program Files (x86)\Internet Explorer\iexplore.exe",
        Title = "Open in Internet Explorer",
        Description = "Open in Internet Explorer",
        Arguments = "http://www.dotnetthoughts.net",
        CustomCategory = "Actions",
        IconResourcePath = @"C:\Program Files (x86)\Internet Explorer\iexplore.exe",
        IconResourceIndex = 0
    };

    var jumpList = new JumpList();
    jumpList.JumpItems.Add(firefoxTask);
    jumpList.JumpItems.Add(ieTask);
    jumpList.ShowFrequentCategory = false;
    jumpList.ShowRecentCategory = false;

    JumpList.SetJumpList(Application.Current, jumpList);
    base.OnStartup(e);
}

Happy Programming :)

Cannot publish because a project failed to build

Yesterday while working on one ClickOnce project deployment, I got an interesting error like this.

Cannot publish because a project failed to Build. An error occurred while signing - Signtool.exe not found.

Cannot publish because a project failed to Build. An error occurred while signing - Signtool.exe not found.

It was working long back, but suddenly it stopped working. Then I found the problem, it was because of .Net Framework 4.5 developer preview installation. I un installed it. You may also need to repair the Visual Studio installation, otherwise Visual Studio will not work.

Happy Programming :)