private void LaunchDebugger(IServiceProvider provider, VsDebugTargetInfo dbgInfo) { if (!Directory.Exists(dbgInfo.bstrCurDir)) { MessageBox.Show(String.Format("Working directory \"{0}\" does not exist.", dbgInfo.bstrCurDir), SR.ProductName); } else if (!File.Exists(dbgInfo.bstrExe)) { MessageBox.Show(String.Format("Interpreter \"{0}\" does not exist.", dbgInfo.bstrExe), SR.ProductName); } else if (DoesProjectSupportDebugging()) { VsShellUtilities.LaunchDebugger(provider, dbgInfo); } }
public virtual int DebugLaunch(uint flags) { CCITracing.TraceCall(); try { VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; // On first call, reset the cache, following calls will use the cached values string property = GetConfigurationProperty("StartProgram", true); if (string.IsNullOrEmpty(property)) { info.bstrExe = this.project.GetOutputAssembly(this.ConfigName); } else { info.bstrExe = property; } property = GetConfigurationProperty("WorkingDirectory", false); if (string.IsNullOrEmpty(property)) { info.bstrCurDir = Path.GetDirectoryName(info.bstrExe); } else { info.bstrCurDir = property; } property = GetConfigurationProperty("CmdArgs", false); if (!string.IsNullOrEmpty(property)) { info.bstrArg = property; } property = GetConfigurationProperty("RemoteDebugMachine", false); if (property != null && property.Length > 0) { info.bstrRemoteMachine = property; } info.fSendStdoutToOutputWindow = 0; info.clsidCustom = VSConstants.CLSID_ComPlusOnlyDebugEngine; info.grfLaunch = flags; VsShellUtilities.LaunchDebugger(this.project.Site, info); } catch (Exception e) { Trace.WriteLine("Exception : " + e.Message); return(Marshal.GetHRForException(e)); } return(VSConstants.S_OK); }
public void Launch(IServiceProvider provider) { var error = Validate(); if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error, SR.ProductName); return; } VsShellUtilities.LaunchDebugger(provider, Info); }
public void StartInBrowser(string url, Guid?debugEngine) { if (debugEngine.HasValue) { // launch via VS debugger, it'll take care of figuring out the browsers VsDebugTargetInfo dbgInfo = new VsDebugTargetInfo(); dbgInfo.dlo = (DEBUG_LAUNCH_OPERATION)_DEBUG_LAUNCH_OPERATION3.DLO_LaunchBrowser; dbgInfo.bstrExe = url; dbgInfo.clsidCustom = debugEngine.Value; dbgInfo.grfLaunch = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd | (uint)__VSDBGLAUNCHFLAGS4.DBGLAUNCH_UseDefaultBrowser; dbgInfo.cbSize = (uint)Marshal.SizeOf(dbgInfo); VsShellUtilities.LaunchDebugger(_serviceProvider, dbgInfo); } else { // run the users default browser var handler = GetBrowserHandlerProgId(); var browserCmd = (string)Registry.ClassesRoot.OpenSubKey(handler).OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command").GetValue(""); if (browserCmd.IndexOf("%1") != -1) { browserCmd = browserCmd.Replace("%1", url); } else { browserCmd = browserCmd + " " + url; } bool inQuote = false; string cmdLine = null; for (int i = 0; i < browserCmd.Length; i++) { if (browserCmd[i] == '"') { inQuote = !inQuote; } if (browserCmd[i] == ' ' && !inQuote) { cmdLine = browserCmd.Substring(0, i); break; } } if (cmdLine == null) { cmdLine = browserCmd; } Process.Start(cmdLine, browserCmd.Substring(cmdLine.Length)); } }
public void Execute(uint grfLaunch) { var launchParameters = _launchParametersProvider.Get(); _validator.Validate(launchParameters); var launchInfo = CreateClojureLaunchInfo(launchParameters, grfLaunch); if (launchParameters.StartupFileType == StartupFileType.Executable) { launchInfo = CreateExecutableLaunchInfo(launchParameters, grfLaunch); } VsShellUtilities.LaunchDebugger(_project.Site, launchInfo); }
private void LaunchDebugger(IServiceProvider provider, VsDebugTargetInfo dbgInfo) { if (!Directory.Exists(UnquotePath(dbgInfo.bstrCurDir))) { MessageBox.Show(String.Format("Working directory \"{0}\" does not exist.", dbgInfo.bstrCurDir), "Node.js Tools for Visual Studio"); } else if (!File.Exists(UnquotePath(dbgInfo.bstrExe))) { MessageBox.Show(String.Format("Interpreter \"{0}\" does not exist.", dbgInfo.bstrExe), "Node.js Tools for Visual Studio"); } else if (DoesProjectSupportDebugging()) { VsShellUtilities.LaunchDebugger(provider, dbgInfo); } }
private void LaunchDebugger(IServiceProvider provider, VsDebugTargetInfo dbgInfo) { if (!Directory.Exists(dbgInfo.bstrCurDir)) { MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.DebugWorkingDirectoryDoesNotExistErrorMessage, dbgInfo.bstrCurDir), SR.ProductName); } else if (!File.Exists(dbgInfo.bstrExe)) { MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.DebugInterpreterDoesNotExistErrorMessage, dbgInfo.bstrExe), SR.ProductName); } else if (DoesProjectSupportDebugging()) { VsShellUtilities.LaunchDebugger(provider, dbgInfo); } }
private static void LaunchDebugger(IServiceProvider provider, VsDebugTargetInfo dbgInfo) { if (!Directory.Exists(UnquotePath(dbgInfo.bstrCurDir))) { MessageBox.Show(String.Format("Working directory \"{0}\" does not exist.", dbgInfo.bstrCurDir)); } else if (!File.Exists(UnquotePath(dbgInfo.bstrExe))) { MessageBox.Show(String.Format("Interpreter \"{0}\" does not exist.", dbgInfo.bstrExe)); } else { VsShellUtilities.LaunchDebugger(provider, dbgInfo); } }
/// <summary> /// Launches a debugger with provided parameters. /// </summary> /// <param name="provider">Service provider.</param> /// <param name="dbgInfo">Debugger information.</param> private static void LaunchDebugger(IServiceProvider provider, VsDebugTargetInfo dbgInfo) { if (!Directory.Exists(UnquotePath(dbgInfo.bstrCurDir))) { string message = string.Format("Working directory \"{0}\" does not exist.", dbgInfo.bstrCurDir); MessageBox.Show(message, Resources.NodeToolsTitle); return; } if (!File.Exists(UnquotePath(dbgInfo.bstrExe))) { string message = String.Format("Unable to find \"{0}\" executable location.\nPlease setup node.js directory in the project settings.", dbgInfo.bstrExe); MessageBox.Show(message, Resources.NodeToolsTitle); return; } VsShellUtilities.LaunchDebugger(provider, dbgInfo); }
// ------------------------------------------------------ /// <summary> /// Launches the tests for the solution. /// </summary> public void LaunchTests() { HierarchyItem startupProject = VsShellUtils.GetStartupProject(this); lastRunProject = startupProject; if (startupProject == null) { return; } TryToSetTestResultsText("Running the tests..."); debuggerEvents.StartingTestRun = true; uint flags = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd; string projectDir = startupProject.ProjectDirectory; string workingDir = GetActiveWorkingDirectory(startupProject); string exePath = GetActiveExecutablePath(startupProject); Guid guidNativeOnlyEng = new Guid("3B476D35-A401-11D2-AAD4-00C04F990171"); VsDebugTargetInfo debugTarget = new VsDebugTargetInfo(); debugTarget.bstrExe = exePath; debugTarget.bstrCurDir = workingDir; debugTarget.fSendStdoutToOutputWindow = 1; debugTarget.grfLaunch = flags; debugTarget.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; debugTarget.clsidCustom = guidNativeOnlyEng; VsShellUtilities.LaunchDebugger(this, debugTarget); }
/// <summary> /// Called by the vs shell to start debugging (managed or unmanaged). /// Override this method to support other debug engines. /// </summary> /// <param name="grfLaunch">A flag that determines the conditions under which to start the debugger. For valid grfLaunch values, see __VSDBGLAUNCHFLAGS</param> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code</returns> public virtual int DebugLaunch(uint grfLaunch) { CCITracing.TraceCall(); try { VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; // On first call, reset the cache, following calls will use the cached values string property = GetConfigurationProperty("StartProgram", true); if (string.IsNullOrEmpty(property)) { info.bstrExe = this.project.GetOutputAssembly(this.ConfigName); } else { info.bstrExe = property; } property = GetConfigurationProperty("WorkingDirectory", false); if (string.IsNullOrEmpty(property)) { info.bstrCurDir = Path.GetDirectoryName(info.bstrExe); } else { info.bstrCurDir = property; } property = GetConfigurationProperty("CmdArgs", false); if (!string.IsNullOrEmpty(property)) { info.bstrArg = property; } property = GetConfigurationProperty("RemoteDebugMachine", false); if (property != null && property.Length > 0) { info.bstrRemoteMachine = property; } info.fSendStdoutToOutputWindow = 0; property = GetConfigurationProperty("EnableUnmanagedDebugging", false); if (property != null && string.Compare(property, "true", StringComparison.OrdinalIgnoreCase) == 0) { //Set the unmanged debugger //TODO change to vsconstant when it is available in VsConstants (guidNativeOnlyEng was the old name, maybe it has got a new name) info.clsidCustom = new Guid("{3B476D35-A401-11D2-AAD4-00C04F990171}"); } else { //Set the managed debugger info.clsidCustom = VSConstants.CLSID_ComPlusOnlyDebugEngine; } info.grfLaunch = grfLaunch; VsShellUtilities.LaunchDebugger(this.project.Site, info); } catch (Exception e) { Trace.WriteLine("Exception : " + e.Message); return(Marshal.GetHRForException(e)); } return(VSConstants.S_OK); }
public override int DebugLaunch(uint grfLaunch) { CCITracing.TraceCall(); try { VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; // On first call, reset the cache, following calls will use the cached values string property = GetConfigurationProperty("DebuggerCommand", true); if (string.IsNullOrEmpty(property)) { property = this._project.GetOutputAssembly(this.ConfigCanonicalName); } info.bstrExe = property; property = GetConfigurationProperty("DebuggerWorkingDirectory", false); if (string.IsNullOrEmpty(property)) { property = Path.GetDirectoryName(info.bstrExe); } info.bstrCurDir = property; property = GetConfigurationProperty("DebuggerCommandArguments", false); if (!string.IsNullOrEmpty(property)) { info.bstrArg = property; } property = GetConfigurationProperty("RemoteDebugMachine", false); if (property != null && property.Length > 0) { info.bstrRemoteMachine = property; } property = GetConfigurationProperty("RedirectToOutputWindow", false); if (property != null && string.Compare(property, "true", StringComparison.OrdinalIgnoreCase) == 0) { info.fSendStdoutToOutputWindow = 1; } else { info.fSendStdoutToOutputWindow = 0; } property = GetConfigurationProperty("EnableUnmanagedDebugging", false); if (property != null && string.Compare(property, "true", StringComparison.OrdinalIgnoreCase) == 0) { info.clsidCustom = VSConstants.DebugEnginesGuids.ManagedAndNative_guid; // {92EF0900-2251-11D2-B72E-0000F87572EF} } else { info.clsidCustom = VSConstants.DebugEnginesGuids.ManagedOnly_guid; // {449EC4CC-30D2-4032-9256-EE18EB41B62B} } info.grfLaunch = grfLaunch; VsShellUtilities.LaunchDebugger(this._project.Site, info); } catch (Exception e) { XSharpProjectPackage.Instance.DisplayException(e); return(Marshal.GetHRForException(e)); } return(VSConstants.S_OK); }
/// <summary> /// Called by the vs shell to start debugging (managed or unmanaged). /// Override this method to support other debug engines. /// </summary> /// <param name="grfLaunch">A flag that determines the conditions under which to start the debugger. For valid grfLaunch values, see __VSDBGLAUNCHFLAGS</param> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code</returns> public virtual int DebugLaunch(uint grfLaunch) { CciTracing.TraceCall(); try { VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; // On first call, reset the cache, following calls will use the cached values string property = GetConfigurationProperty("StartProgram", _PersistStorageType.PST_USER_FILE, true); if (string.IsNullOrEmpty(property)) { info.bstrExe = this._project.GetOutputAssembly(this.ConfigName, this.Platform); } else { info.bstrExe = property; } property = GetConfigurationProperty("WorkingDirectory", _PersistStorageType.PST_USER_FILE, false); if (string.IsNullOrEmpty(property)) { info.bstrCurDir = Path.GetDirectoryName(info.bstrExe); } else { info.bstrCurDir = property; } property = GetConfigurationProperty("CmdArgs", _PersistStorageType.PST_USER_FILE, false); if (!string.IsNullOrEmpty(property)) { info.bstrArg = property; } property = GetConfigurationProperty("RemoteDebugMachine", _PersistStorageType.PST_USER_FILE, false); if (property != null && property.Length > 0) { info.bstrRemoteMachine = property; } info.fSendStdoutToOutputWindow = 0; property = GetConfigurationProperty("EnableUnmanagedDebugging", _PersistStorageType.PST_USER_FILE, false); if (property != null && string.Equals(property, "true", StringComparison.OrdinalIgnoreCase)) { //Set the unmanged debugger info.clsidCustom = VSConstants.DebugEnginesGuids.NativeOnly_guid; } else { //Set the managed debugger info.clsidCustom = VSConstants.DebugEnginesGuids.ManagedOnly_guid; } info.grfLaunch = grfLaunch; VsShellUtilities.LaunchDebugger(this._project.Site, info); } catch (Exception e) { Trace.WriteLine("Exception : " + e.Message); return(Marshal.GetHRForException(e)); } return(VSConstants.S_OK); }
/// <summary> /// Starts the debugger with the provided info. /// </summary> /// <exception cref="FileNotFoundException"> /// The provided executable was not found. /// </exception> /// <exception cref="DirectoryNotFoundException"> /// The provided working directory was not found. /// </exception> public void Launch() { Validate(); VsShellUtilities.LaunchDebugger(_provider, Info); }
public override int DebugLaunch(uint grfLaunch) { CCITracing.TraceCall(); try { if (grfLaunch == 0) { grfLaunch = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_Silent; } VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; // On first call, reset the cache, following calls will use the cached values string property = GetConfigurationProperty(XSharpProjectFileConstants.DebuggerCommand, true); if (string.IsNullOrEmpty(property)) { property = this._project.GetOutputAssembly(this.ConfigCanonicalName); } info.bstrExe = property; property = GetConfigurationProperty(XSharpProjectFileConstants.DebuggerWorkingDirectory, false); if (string.IsNullOrEmpty(property)) { property = Path.GetDirectoryName(info.bstrExe); } if (!Path.IsPathRooted(property)) { property = Path.Combine(this.ProjectMgr.ProjectFolder, property); } info.bstrCurDir = property; property = GetConfigurationProperty(XSharpProjectFileConstants.DebuggerCommandArguments, false); if (!string.IsNullOrEmpty(property)) { info.bstrArg = property; } property = GetConfigurationProperty("RemoteDebugMachine", false); if (property != null && property.Length > 0) { info.bstrRemoteMachine = property; } property = GetConfigurationProperty("RedirectToOutputWindow", false); if (property != null && string.Compare(property, "true", StringComparison.OrdinalIgnoreCase) == 0) { info.fSendStdoutToOutputWindow = 1; } else { info.fSendStdoutToOutputWindow = 0; } property = GetConfigurationProperty(XSharpProjectFileConstants.EnableUnmanagedDebugging, false); if (property != null && string.Compare(property, "true", StringComparison.OrdinalIgnoreCase) == 0) { info.clsidCustom = VSConstants.DebugEnginesGuids.ManagedAndNative_guid; // {92EF0900-2251-11D2-B72E-0000F87572EF} } else { info.clsidCustom = VSConstants.DebugEnginesGuids.ManagedOnly_guid; // {449EC4CC-30D2-4032-9256-EE18EB41B62B} } if (!string.IsNullOrEmpty(this.ProjectMgr.BuildProject.Xml.Sdk)) { // Sdk style project info.clsidCustom = VSConstants.DebugEnginesGuids.CoreSystemClr_guid; } info.grfLaunch = grfLaunch; VsShellUtilities.LaunchDebugger(this._project.Site, info); } catch (Exception e) { XSettings.LogException(e, "DebugLaunch"); return(Marshal.GetHRForException(e)); } return(VSConstants.S_OK); }
public override int DebugLaunch(uint aLaunch) { Logger.TraceMethod(MethodBase.GetCurrentMethod()); try { var xDeployment = (DeploymentType)Enum.Parse(typeof(DeploymentType), GetConfigurationProperty(BuildPropertyNames.DeploymentString, true)); var xLaunch = (LaunchType)Enum.Parse(typeof(LaunchType), GetConfigurationProperty(BuildPropertyNames.LaunchString, false)); var xVSDebugPort = GetConfigurationProperty(BuildPropertyNames.VisualStudioDebugPortString, false); string xOutputAsm = ProjectMgr.GetOutputAssembly(ConfigName); string xOutputPath = Path.GetDirectoryName(xOutputAsm); string xIsoFile = Path.ChangeExtension(xOutputAsm, ".iso"); string xBinFile = Path.ChangeExtension(xOutputAsm, ".bin"); if (xDeployment == DeploymentType.ISO) { IsoMaker.Generate(xBinFile, xIsoFile); } else if (xDeployment == DeploymentType.USB) { Process.Start(Path.Combine(CosmosPaths.Tools, "Cosmos.Deploy.USB.exe"), "\"" + xBinFile + "\""); } else if (xDeployment == DeploymentType.PXE) { string xPxePath = Path.Combine(CosmosPaths.Build, "PXE"); string xPxeIntf = GetConfigurationProperty(BuildPropertyNames.PxeInterfaceString, false); File.Copy(xBinFile, Path.Combine(xPxePath, "Cosmos.bin"), true); Process.Start(Path.Combine(CosmosPaths.Tools, "Cosmos.Deploy.Pixie.exe"), xPxeIntf + " \"" + xPxePath + "\""); } else if (xDeployment == DeploymentType.BinaryImage) { // prepare? } else { throw new Exception("Unknown deployment type."); } if (xLaunch == LaunchType.None && xDeployment == DeploymentType.ISO) { Process.Start(xOutputPath); } else { // http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.vsdebugtargetinfo_members.aspx var xInfo = new VsDebugTargetInfo(); xInfo.cbSize = (uint)Marshal.SizeOf(xInfo); xInfo.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; xInfo.fSendStdoutToOutputWindow = 0; // App keeps its stdout xInfo.grfLaunch = aLaunch; // Just pass through for now. xInfo.bstrRemoteMachine = null; // debug locally var xValues = new Dictionary <string, string>(); xValues.Add("ProjectFile", Path.Combine(ProjectMgr.ProjectFolder, ProjectMgr.ProjectFile)); xValues.Add("ISOFile", xIsoFile); //xValues.Add("BinFormat", GetConfigurationProperty("BinFormat", false)); foreach (var xName in BuildProperties.PropNames) { xValues.Add(xName, GetConfigurationProperty(xName, false)); } xInfo.bstrExe = DictionaryHelper.DumpToString(xValues); // Select the debugger xInfo.clsidCustom = Cosmos.VS.DebugEngine.AD7.Impl.AD7Engine.EngineID; // Debug engine identifier. // ??? This identifier doesn't seems to appear anywhere else in souce code. //xInfo.clsidPortSupplier = new Guid("{708C1ECA-FF48-11D2-904F-00C04FA302A1}"); VsShellUtilities.LaunchDebugger(ProjectMgr.Site, xInfo); } } catch (Exception ex) { return(Marshal.GetHRForException(ex)); } return(VSConstants.S_OK); }
/// <summary> /// Called by the vs shell to start debugging (managed or unmanaged). /// Override this method to support other debug engines. /// </summary> /// <param name="grfLaunch">A flag that determines the conditions under which to start the debugger. For valid grfLaunch values, see __VSDBGLAUNCHFLAGS</param> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code</returns> /*public override int DebugLaunch(uint grfLaunch) * { * // System.Windows.Forms.MessageBox.Show("SquirrelProjectConfig.DebugLaunch", "Debugger debugging", System.Windows.Forms.MessageBoxButtons.OK, 0); * * //CCITracing.TraceCall(); * * try * { * * VsDebugTargetInfo info = new VsDebugTargetInfo(); * info.cbSize = (uint)Marshal.SizeOf(info); * info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; * * string interpreter; * string workingdirectory; * bool localhost = false; * int port = 1234; * string targetaddress; * string commandlineoptions; * string pathfixup; * bool suspendonstartup = false; * bool autoruninterpreter = true; * * string projectfolder = ProjectMgr.ProjectFolder; * interpreter = FetchStringProperty("Interpreter", ""); * workingdirectory = FetchStringProperty("WorkingDirectory", Path.GetDirectoryName(interpreter)); * suspendonstartup = FetchBoolProperty("SuspendOnStartup", false); * autoruninterpreter = true;//FetchBoolProperty("AutorunInterpreter", true); * * localhost = FetchBoolProperty("Localhost", true); * targetaddress = FetchStringProperty("TargetAddress", "127.0.0.1"); * pathfixup = FetchStringProperty("PathFixup", ""); * pathfixup = pathfixup.Replace(',', '#'); * if (localhost) * { * //overrides the setting if localhost is true * targetaddress = "127.0.0.1"; * } * commandlineoptions = FetchStringProperty("CommandLineOptions", ""); * port = FetchIntProperty("Port", 1234); * * info.bstrExe = interpreter; * info.bstrCurDir = workingdirectory; * info.bstrArg = commandlineoptions; * info.bstrOptions = targetaddress + "," + port.ToString() + "," + autoruninterpreter.ToString() + "," + suspendonstartup.ToString() + "," + projectfolder + "," + pathfixup; * * * //squirrel debugger * info.bstrPortName = "SquirrelPort"; * info.clsidPortSupplier = SQProjectGuids.guidPortSupplier; * info.clsidCustom = SQProjectGuids.guidDebugEngine; * info.grfLaunch = grfLaunch; * VsShellUtilities.LaunchDebugger(this.ProjectMgr.Site, info); * } * catch (Exception e) * { * Trace.WriteLine("Exception : " + e.Message); * * return Marshal.GetHRForException(e); * } * * return VSConstants.S_OK; * }*/ public override int DebugLaunch(uint grfLaunch) { //CCITracing.TraceCall(); try { EnvDTE.DTE dte = ProjectMgr.Site.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; // EnvDTE.DTE dte = (EnvDTE.DTE)_ls.GetService(typeof(EnvDTE.DTE)); List <KeyValuePair <string, string> > pns = new List <KeyValuePair <string, string> >(); EnvDTE.Projects projects = dte.Solution.Projects; foreach (object prj in projects) { SQAutomationProject p = prj as SQAutomationProject; if (p != null) { ProjectNode spn = p.Project as ProjectNode; string pathfixup = spn.GetProjectProperty(Resources.PathFixup);//.BuildProject.EvaluatedProperties; if (string.IsNullOrEmpty(pathfixup)) { continue; } //string pathfixup = (string)bpg["PathFixup"]; string projfolder = spn.ProjectFolder; if (!projfolder.EndsWith("\\")) { projfolder += "\\"; } KeyValuePair <string, string> pair = new KeyValuePair <string, string>(projfolder, pathfixup); pns.Add(pair); } else { //this sometimes happens even if there is only 1 project, is wierdm, who knows!? //Console.WriteLine(prj.ToString()); } } VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; string interpreter; string workingdirectory; bool localhost = false; int port = 1234; string targetaddress; string commandlineoptions; //string pathfixup; bool suspendonstartup = false; bool autoruninterpreter = true; string projectfolder = ProjectMgr.ProjectFolder; interpreter = FetchStringProperty("Interpreter", ""); if (string.IsNullOrEmpty(interpreter) || !File.Exists(interpreter)) { throw new Exception("The Interpreter path is invalid. Please change this in the Project Settings > Debugger > Interpreter."); } workingdirectory = FetchStringProperty("WorkingDirectory", Path.GetDirectoryName(interpreter)); suspendonstartup = FetchBoolProperty("SuspendOnStartup", false); autoruninterpreter = FetchBoolProperty("AutorunInterpreter", true); localhost = FetchBoolProperty("Localhost", true); targetaddress = FetchStringProperty("TargetAddress", "127.0.0.1"); //string pathfixup = FetchStringProperty("PathFixup", ""); //pathfixup = pathfixup.Replace(',', '#'); if (localhost) { //overrides the setting if localhost is true targetaddress = "127.0.0.1"; } commandlineoptions = FetchStringProperty("CommandLineOptions", ""); port = FetchIntProperty("Port", 1234); int connectiondelay = FetchIntProperty("ConnectionDelay", 1000); int connectiontries = FetchIntProperty("ConnectionTries", 3); StringBuilder sb = new StringBuilder(); XmlWriterSettings xws = new XmlWriterSettings(); xws.Indent = true; xws.OmitXmlDeclaration = true; XmlWriter w = XmlWriter.Create(sb, xws); w.WriteStartDocument(); w.WriteStartElement("params"); w.WriteAttributeString("targetaddress", targetaddress); w.WriteAttributeString("port", port.ToString()); w.WriteAttributeString("autoruninterpreter", autoruninterpreter.ToString()); w.WriteAttributeString("suspendonstartup", suspendonstartup.ToString()); w.WriteAttributeString("connectiondelay", connectiondelay.ToString()); w.WriteAttributeString("connectiontries", connectiontries.ToString()); foreach (KeyValuePair <string, string> kv in pns) { w.WriteStartElement("context"); w.WriteAttributeString("rootpath", kv.Key); w.WriteAttributeString("pathfixup", kv.Value); w.WriteEndElement(); } w.WriteEndElement(); w.WriteEndDocument(); w.Flush(); w.Close(); info.bstrExe = interpreter; info.bstrCurDir = workingdirectory; info.bstrArg = commandlineoptions; info.bstrOptions = sb.ToString();// targetaddress + "," + port.ToString() + "," + autoruninterpreter.ToString() + "," + suspendonstartup.ToString() + "," + projectfolder + "," + pathfixup; //squirrel debugger info.bstrPortName = "SquirrelPort"; info.clsidPortSupplier = SQProjectGuids.guidPortSupplier; //new Guid("{C419451D-BC37-44f7-901E-880E74B7D886}"); info.clsidCustom = SQProjectGuids.guidDebugEngine; //new Guid("{3F1D8F51-4A1C-4ac2-962B-BA96794D8373}"); info.grfLaunch = grfLaunch; VsShellUtilities.LaunchDebugger(this.ProjectMgr.Site, info); } catch (Exception e) { Trace.WriteLine("Exception : " + e.Message); return(Marshal.GetHRForException(e)); } return(VSConstants.S_OK); }