Beispiel #1
0
        public override bool CanDebugCommand(ExecutionCommand cmd)
        {
            if (cmd is DotNetCoreExecutionCommand dotnet)
            {
                return(true);
            }

            return(cmd.GetType().Name == "AspNetCoreExecutionCommand");
        }
Beispiel #2
0
        public override DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand cmd)
        {
            if (cmd is DotNetCoreExecutionCommand command)
            {
                DebuggerStartInfo startInfo = new DebuggerStartInfo
                {
                    Command          = command.OutputPath,
                    Arguments        = command.DotNetArguments,
                    WorkingDirectory = command.WorkingDirectory
                };
                if (command.EnvironmentVariables.Count > 0)
                {
                    foreach (KeyValuePair <string, string> val in command.EnvironmentVariables)
                    {
                        startInfo.EnvironmentVariables[val.Key] = val.Value;
                    }
                }

                return(startInfo);
            }
            else if (cmd.GetType().Name == "AspNetCoreExecutionCommand")
            {
                DebuggerStartInfo startInfo = new DebuggerStartInfo
                {
                    Command          = (string)GetPropValue(cmd, "OutputPath"),
                    Arguments        = (string)GetPropValue(cmd, "DotNetArguments"),
                    WorkingDirectory = (string)GetPropValue(cmd, "WorkingDirectory")
                };
                var variables = (IDictionary <string, string>)GetPropValue(cmd, "EnvironmentVariables");
                if (variables.Count > 0)
                {
                    foreach (KeyValuePair <string, string> val in variables)
                    {
                        startInfo.EnvironmentVariables[val.Key] = val.Value;
                    }
                }

                return(startInfo);
            }

            throw new NotSupportedException("Only .NET Core projects are supported.");
        }