[ACCEPTED]-How do I open links in Visual Studio in my web browser and not in Visual Studio?-hyperlink
There is an extension that provides this 5 behavior called Open in External Browser. It works in Visual Studio 4 2012, 2013, 2015 and 2017. (An old version 3 available on GitHub supports Visual Studio 2010.)
EDIT: The Visual Studio team is finally starting to work on putting this right into Visual Studio. Status of this feature request just moved from "Under Review" to "Started".
I could not find a setting for this so I 5 wrote a simple macro that you can use. You 4 can bind this to a key-combo like all macros. This 3 will get the job done until we get a better 2 answer.
Sub OpenURLInChrome() 'copy to end of line DTE.ActiveDocument.Selection.EndOfLine(True) 'set var Dim url As String = DTE.ActiveDocument.Selection.Text 'launch chrome with url System.Diagnostics.Process.Start( _ Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) _ + "\Google\Chrome\Application\chrome.exe", url) End Sub
Just put your cursor in front of 1 the url and run the macro...
This is an improvement on the macro suggested 5 above by mracoker.
This macro looks for a 4 URL on the current line and does not capture 3 text after the URL as the previous answer 2 did.
Sub OpenURLInChrome() ' Select to end of line DTE.ActiveDocument.Selection.EndOfLine(True) Dim selection As TextSelection = DTE.ActiveDocument.Selection ' Find URL within selection Dim match = System.Text.RegularExpressions.Regex.Match( _ selection.Text, ".*(http\S+)") Dim url As String = "" If (match.Success) Then If match.Groups.Count = 2 Then url = match.Groups(1).Value End If End If ' Remove selection selection.SwapAnchor() selection.Collapse() If (url = String.Empty) Then MsgBox("No URL found") End If ' Launch chrome with url System.Diagnostics.Process.Start( _ Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) _ + "\Google\Chrome\Application\chrome.exe", url) End Sub
To use: place cursor somewhere before 1 the URL; Run Macro (I mapped to Ctrl-Shift-G)
More Related questions