VS Extension: Open Web Address with Visual Studio Browser
使用VS 打开链接
using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; 。。。 public static void OpenWebInVS(string address, bool newWindow = true) { IVsWindowFrame ppFrame; var service = Package.GetGlobalService(typeof(IVsWebBrowsingService)) as IVsWebBrowsingService; uint windowFlag = 0; if (newWindow) windowFlag = (uint)__VSWBNAVIGATEFLAGS.VSNWB_ForceNew; service.Navigate(address, windowFlag, out ppFrame); }
使用VS调用外部默认浏览器打开链接:
public static void OpenWebInDefaultExplorer(string address) { Microsoft.VisualStudio.Shell.VsShellUtilities.OpenBrowser(address, (uint)__VSOSPFLAGS.OSP_LaunchNewBrowser); //System.Diagnostics.Process.Start(address); }