Skip to content
Merged
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
42 changes: 42 additions & 0 deletions src/MSBuild.UnitTests/XMake_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,48 @@ public void ResponseFileInProjectDirectoryWithSolutionProjectDifferentNamesShoul
successfulExit.ShouldBeTrue();
}

[Fact]
public void ResponseFileNoticeIsPrintedOnSwitchError()
{
_env.SetEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US");
var directory = _env.CreateFolder();
var content = ObjectModelHelpers.CleanupFileContents("<Project><Target Name='t'><Message Text='Completed'/></Target></Project>");
directory.CreateFile("foo.proj", content);
var projectPath = directory.CreateFile("bar.proj", content).Path;
var rspPath = directory.CreateFile("Directory.Build.rsp", "foo.proj").Path;

string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);

successfulExit.ShouldBeFalse();
int noticeIndex = output.IndexOf("Some command line switches were read from", StringComparison.OrdinalIgnoreCase);
int errorIndex = output.IndexOf("MSB1008", StringComparison.OrdinalIgnoreCase);
noticeIndex.ShouldBeGreaterThanOrEqualTo(0);
errorIndex.ShouldBeGreaterThanOrEqualTo(0);
noticeIndex.ShouldBeLessThan(errorIndex);
output.ShouldContain(rspPath);
}

[Fact]
public void ExplicitResponseFileNoticeIsPrintedOnSwitchError()
{
_env.SetEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US");
var directory = _env.CreateFolder();
var content = ObjectModelHelpers.CleanupFileContents("<Project><Target Name='t'><Message Text='Completed'/></Target></Project>");
directory.CreateFile("foo.proj", content);
var projectPath = directory.CreateFile("bar.proj", content).Path;
var rspPath = directory.CreateFile("explicit.rsp", "foo.proj").Path;

string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\" @\"{rspPath}\" -noAutoResponse", out var successfulExit, _output);

successfulExit.ShouldBeFalse();
int noticeIndex = output.IndexOf("Some command line switches were read from", StringComparison.OrdinalIgnoreCase);
int errorIndex = output.IndexOf("MSB1008", StringComparison.OrdinalIgnoreCase);
noticeIndex.ShouldBeGreaterThanOrEqualTo(0);
errorIndex.ShouldBeGreaterThanOrEqualTo(0);
noticeIndex.ShouldBeLessThan(errorIndex);
output.ShouldContain(rspPath);
}
Comment thread
AlesProkop marked this conversation as resolved.

/// <summary>
/// Any msbuild.rsp in the directory of the specified project/solution should be read, and should
/// take priority over any other response files. Sanity test when there isn't one.
Expand Down
14 changes: 14 additions & 0 deletions src/MSBuild/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,20 @@
where the switches are coming from.
</comment>
</data>
<data name="PickedUpSwitchesFromResponseFile" xml:space="preserve">
<value>Some command line switches were read from this response file:</value>
<comment>
UE: This message appears before a command-line parsing error when switches were read from a response file: otherwise the user may be unaware where the switches are coming from.
LOCALIZATION: The response file path is printed on a separate line after this message.
</comment>
</data>
<data name="PickedUpSwitchesFromResponseFiles" xml:space="preserve">
Comment thread
AlesProkop marked this conversation as resolved.
<value>Some command line switches were read from these response files:</value>
<comment>
UE: This message appears before a command-line parsing error when switches were read from response files: otherwise the user may be unaware where the switches are coming from.
LOCALIZATION: The response file paths are printed on separate lines after this message.
</comment>
</data>
<data name="ProjectNotFoundError" xml:space="preserve">
<value>MSBUILD : error MSB1009: Project file does not exist.</value>
<comment>{StrBegin="MSBUILD : error MSB1009: "}UE: This message does not need in-line parameters because the exception takes care of displaying the invalid arg.
Expand Down
16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/MSBuild/Resources/xlf/Strings.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading