Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/Build.UnitTests/Utilities_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,9 @@ public void CommentsInPreprocessing()

env.SetEnvironmentVariable("MSBUILDLOADALLFILESASWRITEABLE", "1");

#if FEATURE_GET_COMMANDLINE
MSBuildApp.Execute(@"c:\bin\msbuild.exe """ + inputFile.Path +
(NativeMethodsShared.IsUnixLike ? @""" -pp:""" : @""" /pp:""") + outputFile.Path + @"""")
.ShouldBe(MSBuildApp.ExitType.Success);
#else
Assert.Equal(
MSBuildApp.ExitType.Success,
MSBuildApp.Execute(
new[] { @"c:\bin\msbuild.exe", '"' + inputFile.Path + '"',
'"' + (NativeMethodsShared.IsUnixLike ? "-pp:" : "/pp:") + outputFile.Path + '"'}));
#endif
MSBuildApp.Execute([ @"c:\bin\msbuild.exe", '"' + inputFile.Path + '"', '"' + (NativeMethodsShared.IsUnixLike ? "-pp:" : "/pp:") + outputFile.Path + '"']));

bool foundDoNotModify = false;
foreach (string line in File.ReadLines(outputFile.Path))
Expand Down
19 changes: 2 additions & 17 deletions src/Build/BackEnd/Client/MSBuildClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ public sealed class MSBuildClient
/// The command line to process.
/// The first argument on the command line is assumed to be the name/path of the executable, and is ignored.
/// </summary>
#if FEATURE_GET_COMMANDLINE
private readonly string _commandLine;
#else
private readonly string[] _commandLine;
#endif

/// <summary>
/// The MSBuild client execution result.
Expand Down Expand Up @@ -112,13 +108,7 @@ public sealed class MSBuildClient
/// on the command line is assumed to be the name/path of the executable, and is ignored</param>
/// <param name="msbuildLocation"> Full path to current MSBuild.exe if executable is MSBuild.exe,
/// or to version of MSBuild.dll found to be associated with the current process.</param>
public MSBuildClient(
#if FEATURE_GET_COMMANDLINE
string commandLine,
#else
string[] commandLine,
#endif
string msbuildLocation)
public MSBuildClient(string[] commandLine, string msbuildLocation)
{
_serverEnvironmentVariables = new();
_exitResult = new();
Expand Down Expand Up @@ -162,12 +152,7 @@ private void CreateNodePipeStream()
public MSBuildClientExitResult Execute(CancellationToken cancellationToken)
{
// Command line in one string used only in human readable content.
string descriptiveCommandLine =
#if FEATURE_GET_COMMANDLINE
_commandLine;
#else
string.Join(" ", _commandLine);
#endif
string descriptiveCommandLine = string.Join(" ", _commandLine);

CommunicationsUtilities.Trace("Executing build with command line '{0}'", descriptiveCommandLine);

Expand Down
7 changes: 1 addition & 6 deletions src/Build/BackEnd/Node/OutOfProcServerNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ public sealed class OutOfProcServerNode : INode, INodePacketFactory, INodePacket
/// <summary>
/// A callback used to execute command line build.
/// </summary>
public delegate (int exitCode, string exitType) BuildCallback(
#if FEATURE_GET_COMMANDLINE
string commandLine);
#else
string[] commandLine);
#endif
public delegate (int exitCode, string exitType) BuildCallback(string[] commandLine);

private readonly BuildCallback _buildFunction;

Expand Down
12 changes: 0 additions & 12 deletions src/Build/BackEnd/Node/ServerNodeBuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ namespace Microsoft.Build.BackEnd
/// </summary>
internal sealed class ServerNodeBuildCommand : INodePacket
{
#if FEATURE_GET_COMMANDLINE
private string _commandLine = default!;
#else
private string[] _commandLine = default!;
#endif
private string _startupDirectory = default!;
private Dictionary<string, string> _buildProcessEnvironment = default!;
private CultureInfo _culture = default!;
Expand All @@ -34,11 +30,7 @@ internal sealed class ServerNodeBuildCommand : INodePacket
/// <summary>
/// Command line including arguments
/// </summary>
#if FEATURE_GET_COMMANDLINE
public string CommandLine => _commandLine;
#else
public string[] CommandLine => _commandLine;
#endif

/// <summary>
/// The startup directory
Expand Down Expand Up @@ -79,11 +71,7 @@ private ServerNodeBuildCommand()
}

public ServerNodeBuildCommand(
#if FEATURE_GET_COMMANDLINE
string commandLine,
#else
string[] commandLine,
#endif
string startupDirectory,
Dictionary<string, string> buildProcessEnvironment,
CultureInfo culture, CultureInfo uiCulture,
Expand Down
47 changes: 46 additions & 1 deletion src/Build/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- MSBuildClient is in experimental namespace and not used outside the MSBuild -->
<!-- OutOfProcServerNode.BuildCallback is in experimental namespace and not used outside the MSBuild -->
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.MSBuildClient.#ctor(System.String,System.String)</Target>
<Left>lib/net472/Microsoft.Build.dll</Left>
<Right>lib/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.OutOfProcServerNode.BuildCallback.BeginInvoke(System.String,System.AsyncCallback,System.Object)</Target>
<Left>lib/net472/Microsoft.Build.dll</Left>
<Right>lib/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.OutOfProcServerNode.BuildCallback.Invoke(System.String)</Target>
<Left>lib/net472/Microsoft.Build.dll</Left>
<Right>lib/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.MSBuildClient.#ctor(System.String,System.String)</Target>
<Left>ref/net472/Microsoft.Build.dll</Left>
<Right>ref/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.OutOfProcServerNode.BuildCallback.BeginInvoke(System.String,System.AsyncCallback,System.Object)</Target>
<Left>ref/net472/Microsoft.Build.dll</Left>
<Right>ref/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.OutOfProcServerNode.BuildCallback.Invoke(System.String)</Target>
<Left>ref/net472/Microsoft.Build.dll</Left>
<Right>ref/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
1 change: 0 additions & 1 deletion src/Directory.BeforeCommon.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<DefineConstants>$(DefineConstants);FEATURE_ENVIRONMENT_SYSTEMDIRECTORY</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_FILE_TRACKER</DefineConstants>
<DefineConstants Condition="'$(MachineIndependentBuild)' != 'true'">$(DefineConstants);FEATURE_GAC</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_GET_COMMANDLINE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_HANDLEPROCESSCORRUPTEDSTATEEXCEPTIONS</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_HTTP_LISTENER</DefineConstants>
<DefineConstants Condition="'$(MachineIndependentBuild)' != 'true'">$(DefineConstants);FEATURE_INSTALLED_MSBUILD</DefineConstants>
Expand Down
Loading