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,

View File

@@ -127,8 +127,9 @@ public class SharpIdeProjectModel : ISharpIdeNode, IExpandableSharpIdeNode, IChi
? MsBuildEvaluationProjectTask.Result
: throw new InvalidOperationException("Do not attempt to access the MsBuildEvaluationProject before it has been loaded");
public bool IsRunnable => IsBlazorProject || MsBuildEvaluationProject.GetPropertyValue("OutputType") is "Exe" or "WinExe";
public bool IsRunnable => MsBuildEvaluationProject.GetPropertyValue("OutputType") is "Exe" or "WinExe" || IsBlazorProject || IsGodotProject;
public bool IsBlazorProject => MsBuildEvaluationProject.Xml.Sdk is "Microsoft.NET.Sdk.BlazorWebAssembly";
public bool IsGodotProject => MsBuildEvaluationProject.Xml.Sdk.StartsWith("Godot.NET.Sdk");
public bool IsMtpTestProject => MsBuildEvaluationProject.GetPropertyValue("IsTestingPlatformApplication") is "true";
public string BlazorDevServerVersion => MsBuildEvaluationProject.Items.Single(s => s.ItemType is "PackageReference" && s.EvaluatedInclude is "Microsoft.AspNetCore.Components.WebAssembly.DevServer").GetMetadataValue("Version");
public bool OpenInRunPanel { get; set; }