public void SetLaunchData(LaunchData launchData) { var root = Path.GetDirectoryName(typeof(HotReloadManager).Assembly.Location); var reloadifyPath = Path.Combine(root, "Reloadify", "Reloadify.dll"); if (!File.Exists(reloadifyPath)) { return; } var projectDir = Path.GetDirectoryName(launchData.Project); if (!Directory.Exists(projectDir)) { projectDir = launchData.WorkspaceDirectory; } var args = new ProcessArgumentBuilder(); args.AppendQuoted(reloadifyPath); args.AppendQuoted(launchData.Project); args.Append($"-t={launchData.ProjectTargetFramework}"); args.Append($"-p={launchData.Platform}"); args.Append($"-c={launchData.Configuration}"); args.Append($"-f=\"{launchData.WorkspaceDirectory}\""); var runCommand = args.ToString(); runner = new DotnetRunner(runCommand, projectDir, CancellationToken.None, s => Console.WriteLine(s)); }
public async void Stop() { try { runner?.StandardInput?.WriteLine("exit"); await Task.Delay(500); runner?.Kill(); } catch (Exception ex) { } runner = null; }
public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool?outOfProc = null, string verbosityLevel = "normal") { var allArgs = new List <string> { $"-verbosity:{verbosityLevel}", $"-p:Configuration={configuration}", GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildUtilities.WixPropsPath), // Node reuse means that child msbuild processes can stay around after the build completes. // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. "-nr:false", }; if (outOfProc.HasValue) { allArgs.Add($"-p:RunWixToolsOutOfProc={outOfProc.Value}"); } if (arguments != null) { allArgs.AddRange(arguments); } switch (buildSystem) { case BuildSystem.DotNetCoreSdk: { allArgs.Add(projectPath); var result = DotnetRunner.Execute("msbuild", allArgs.ToArray()); return(new MsbuildRunnerResult { ExitCode = result.ExitCode, Output = result.StandardOutput, }); } case BuildSystem.MSBuild: case BuildSystem.MSBuild64: { return(MsbuildRunner.Execute(projectPath, allArgs.ToArray(), buildSystem == BuildSystem.MSBuild64)); } default: { throw new NotImplementedException(); } } }