Visual Studioスタジオコマンドをプログラムで実行します。上記のコードを試しましたが、help.Allはプロジェクトのディレクトリにコマンドプロンプトを表示していません。Visual StudioコマンドプロンプトをVS 2015を使用して実用的に開くことができません
私は入力としてExecute( "VS140COMNTOOLS")を使用しました。
private void Execute(string vsEnvVar) {
var vsInstallPath = Environment.GetEnvironmentVariable(vsEnvVar);
if (Directory.Exists(vsInstallPath)) {
var filePath = vsInstallPath + "vsvars32.bat";
if (File.Exists(filePath)) {
//start vs command process
Process proc = new Process();
var command = Environment.GetEnvironmentVariable("ComSpec");
command = @"" + command + @"";
//var batfile = @"E:\Test\vstest.bat";
var args = string.Format("/S/K \" \"{0}\" \"", filePath);
proc.StartInfo.FileName = command;
proc.StartInfo.Arguments = args;
//proc.StartInfo.RedirectStandardInput = true;
//proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.UseShellExecute = false;
proc.Start();
} else {
Console.WriteLine("File Does not exists " + filePath);
}
}
}
を書き込むことにより、任意のコマンドを実行することができますか? – BugFinder