Add launch settings Executable command support

This commit is contained in:
Matt Parker
2026-01-17 16:35:23 +10:00
parent 25e1f0d62f
commit 7c0587950f
2 changed files with 17 additions and 3 deletions

View File

@@ -38,10 +38,23 @@ public partial class RunService(ILogger<RunService> logger, RoslynAnalysis rosly
var launchProfile = launchProfiles.FirstOrDefault();
try
{
var fileName = launchProfile?.CommandName switch
{
"Executable" => launchProfile.ExecutablePath,
"Project" or _ => "dotnet",
} ?? "dotnet";
var workingDirectory = launchProfile?.WorkingDirectory switch
{
"$(ProjectDir)" => project.DirectoryPath,
null => project.DirectoryPath,
{} nonNullString => nonNullString,
};
var processStartInfo = new ProcessStartInfo2
{
FileName = "dotnet",
WorkingDirectory = Path.GetDirectoryName(project.FilePath),
FileName = fileName,
WorkingDirectory = workingDirectory,
//Arguments = $"run --project \"{project.FilePath}\" --no-restore",
Arguments = await GetRunArguments(project),
RedirectStandardOutput = true,