今日私はElectronを学び始めました。私は自分のプロジェクトをVisual Studioから走らせたいと思っています。私は、デバッグをクリックしてVisual Studioでアプリケーションを起動できるようにしたいと思っています。私はプロジェクトのappディレクトリにelectron.exeを実行するためにmsbuildタスクを使用しましたが、これはビルド時に発生します。私は本当にアプリケーションを起動するデバッグボタンをクリックすることができるようにしたいと思います。 Visual Studio 2015でデバッグボタンの動作を変更する方法を知っている人はいますか?デバッグボタンをクリックして、自分のappディレクトリにelectron.exeを入力して、msbuildのカスタムタスクが行っていることを確認します。カスタムビルド機能を追加するためにVisual Studioのデバッグボタンにフックすることはできますか?
ここに私のmsbuildタスクのコードがあります。プロジェクトデザイナー(プロジェクトのプロパティ)のDebug pageに
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Electron.Tasks
{
public class ElectronBuild : Task
{
[Required]
public string ElectronPath { get; set; }
[Required]
public string AppPath { get; set; }
public override bool Execute()
{
var processStartInfo = new ProcessStartInfo(Path.Combine(ElectronPath, "Electron.exe"))
{
Arguments = AppPath,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false
};
var process = Process.Start(processStartInfo);
var output = process.StandardOutput.ReadToEnd();
output = process.StandardError.ReadToEnd();
Log.LogMessage(output);
return true;
}
}
}