diff --git a/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs b/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs index 41f2b3acce4b77ae8916c1b322a5461ffcbde9a6..f87082f01c64b21ddfc242f73355bfe2f2b46dab 100644 --- a/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs +++ b/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs @@ -72,6 +72,13 @@ public int CodePage get { return _store.GetOrDefault(nameof(CodePage), 0); } } + [Output] + public string CommandLineInvocation + { + set { _store[nameof(CommandLineInvocation)] = value; } + get { return _store.GetOrDefault(nameof(CommandLineInvocation), string.Empty); } + } + public string DebugType { set { _store[nameof(DebugType)] = value; } @@ -187,6 +194,12 @@ public bool Prefer32Bit get { return _store.GetOrDefault(nameof(Prefer32Bit), false); } } + public bool ProvideCommandLineInvocation + { + set { _store[nameof(ProvideCommandLineInvocation)] = value; } + get { return _store.GetOrDefault(nameof(ProvideCommandLineInvocation), false); } + } + public ITaskItem[] References { set { _store[nameof(References)] = value; } @@ -211,6 +224,12 @@ public ITaskItem[] ResponseFiles get { return (ITaskItem[])_store[nameof(ResponseFiles)]; } } + public bool SkipCompilerExecution + { + set { _store[nameof(SkipCompilerExecution)] = value; } + get { return _store.GetOrDefault(nameof(SkipCompilerExecution), false); } + } + public ITaskItem[] Sources { set @@ -312,6 +331,16 @@ protected override Encoding StandardOutputEncoding protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) { + if (ProvideCommandLineInvocation) + { + CommandLineInvocation = GenerateResponseFileContents(); + } + + if (SkipCompilerExecution) + { + return 0; + } + if (!UseSharedCompilation || !String.IsNullOrEmpty(this.ToolPath)) { return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands); diff --git a/src/Compilers/Core/MSBuildTask/Microsoft.CSharp.Core.targets b/src/Compilers/Core/MSBuildTask/Microsoft.CSharp.Core.targets index 876789c758660618f261b87a16a43f3db239e91c..b52435e394f4dfb0d1c780ff2a3516956da521b1 100644 --- a/src/Compilers/Core/MSBuildTask/Microsoft.CSharp.Core.targets +++ b/src/Compilers/Core/MSBuildTask/Microsoft.CSharp.Core.targets @@ -19,7 +19,7 @@ @(_DebugSymbolsIntermediatePath); $(NonExistentFile); @(CustomAdditionalCompileOutputs)" - Returns="" + Returns="$(CscCommandLineInvocation)" DependsOnTargets="$(CoreCompileDependsOn)" >