Visual Studio 2008 allows one to open an existing website by navigating File > Open > WebSite.  Alternatively, one may also use the following shortcut: Shift + ALT + O.  image

But let’s say you would like to open a website by a right-click folder option. Here’s how to do it using a VS Macro and a Registry Entry: 

Open Visual Studio.  Select Tools > Macros > Macros IDE.  Right-click “MyMacros” and select “New module…” At the prompt, name the module “Website”. Add the VsWebSite.Interop.dll reference(Projects > Add Reference) and copy/paste the follow code over the generated Public “Website” module.

Imports System
Imports EnvDTE
Imports EnvDTE80Imports EnvDTE90
Imports System.Diagnostics

Public Module Website

    Sub OpenWebsite(Optional ByVal path As String = “”)

        If (String.Compare(path, String.Empty) = 0) Then
           
MsgBox(“Must supply a folder path to the OpenWebsite macro”,
            MsgBoxStyle.OkOnly)
        Else
            Dim
webPkg As VsWebSite.VSWebPackage
            webPkg = DTE.GetObject(“WebPackage”)
            webPkg.OpenWebSite(path,
            VsWebSite.OpenWebsiteOptions.OpenWebsiteOption_None, False)
        End If

    End Sub

End Module

Now register a shell command enabling an “Open as VS2008 Website” option on any folder in Windows Explorer.  Simply, copy/paste the following script into a new “OpenWebsiteVS2008.reg” file.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\OpenVS2008Web]
@=”Open as VS2008 Website”

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\OpenVS2008Web\command]
@=”\”C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\devenv.exe\”
/command \\\”Macros.MyMacros.Website.OpenWebsite %1\\\”"

Execute (double-click) the file to update the Registry accordingly.  The “Open as VS2008 Website” option will now be available in Windows Explorer.

8 Comments to “Open VS2008 WebSite Macro”

  1. Ralph N says:

    That’s pretty damn useful.

  2. God bless you
    Please I want to have website with this
    Name www. christisalive.co.uk

  3. What information technologies could we use to make it easier to keep track of when new blog posts were made a?

  4. Hayden37 says:

    Hello there! I could have sworn I’ve been to this website before but after browsing through some of the post I realized it’s new to me. Anyhow, I’m definitely happy I found it and I’ll be book-marking and checking back often!

  5. psvita says:

    Thanks, I’ve recently been searching for facts about this topic for ages and yours is the best I’ve located so far.

  6. I savored reading it. I need to check out alot more on this matter. I’m admiring effort and time you devoted your blog, simply because it is actually great place in which I can find lot of important articles.

  7. I want to know who is hosting this website please?

  8. “People can’t understand how much I love Chelsea and I know if I get them in the quarter-finals or the semi-finals, they would be great opponents,” said Mourinho, who has been widely-tipped to retake t he reins at Stamford Bridge in the summer. Chelsea interim manager Roberto Di Matteo believes Wednesday night’s Champions League success will go down as a significant moment in the club’s history.

Leave a Reply

You can wrap your code with [ruby][/ruby] or [python][/python] blocks for syntax highlighting and you can use these traditional tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>