Thank you – wavesmash – for posting the instructions for running a website either from a command line or from a right-mouse-click, into Visual Studio.

I walked through his steps and it worked perfectly… exactly what I needed.

  1. In Visual Studio, open the Macro IDE (Tools > Macros > Macros IDE…)
  2. In MyMacros > References, make sure there is a reference to VsWebSite.Interop and/or VsWebSite.Interop90 (I did both)
  3. Right-mouse click on MyMacros and choose Add > Add New Item
  4. Choose Code File and give a name “Website” then click Add
  5. In the new Website Code File paste the following:
    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
  6. Save and Build

This is ready for running from a command line:

devenv /command “Macros.MyMacros.Website.OpenWebsite C:\MyProjects\MyCompany\CompanySite”

To do this copy the following into a OpenWebsite.reg file and run it.

Windows Registry Editor Version 5.00
@="Open as Visual Studio Website"
@="devenv.exe /command \\\"Macros.MyMacros.Website.OpenWebsite %1\\\""

Now you should be able to right click on a folder in Windows Explorer and select “Open as Website”.