Use csc on coreclr

This commit is contained in:
Andy Gocke 2015-10-15 16:12:56 -07:00 committed by David Fowler
parent 64f539e100
commit 0781d7649a
4 changed files with 17 additions and 3 deletions

View file

@ -141,7 +141,7 @@ namespace Microsoft.DotNet.Tools.Compiler
File.WriteAllLines(rsp, cscArgs);
// Execute CSC!
var result = Command.Create("csc", $"-noconfig @\"{rsp}\"")
var result = RunCsc($"-noconfig @\"{rsp}\"")
.ForwardStdErr()
.ForwardStdOut()
.RunAsync()
@ -149,6 +149,17 @@ namespace Microsoft.DotNet.Tools.Compiler
return result.ExitCode == 0;
}
private static Command RunCsc(string cscArgs)
{
// Hack -- if we find csc + corerun in the app directory we should
// use that, otherwise just try to find csc on the PATH
var corerun = Path.Combine(AppContext.BaseDirectory, "CoreRun.exe");
var csc_exe = Path.Combine(AppContext.BaseDirectory, "csc.exe");
return File.Exists(corerun) && File.Exists(csc_exe)
? Command.Create(corerun, $@"""{csc_exe}"" {cscArgs}")
: Command.Create("csc.exe", cscArgs);
}
private static void ApplyCompilationOptions(CompilerOptions compilationOptions, List<string> cscArgs)
{
var targetType = compilationOptions.EmitEntryPoint.GetValueOrDefault() ? "exe" : "library";