Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct success for /preprocess /targets builds #8908

Merged
merged 2 commits into from
Oct 10, 2023
Merged
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
11 changes: 7 additions & 4 deletions src/MSBuild/XMake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ internal static bool BuildProject(
InitializationException.Throw(ResourceUtilities.FormatResourceStringStripCodeAndKeyword("ProjectUpgradeNeededToVcxProj", projectFile), null);
}

bool success = false;
bool success = true;

ProjectCollection projectCollection = null;
bool onlyLogCriticalEvents = false;
Expand Down Expand Up @@ -1264,11 +1264,12 @@ internal static bool BuildProject(

if (isPreprocess)
{
success = false;

// TODO: Support /preprocess for solution files. https://github.com/dotnet/msbuild/issues/7697
if (isSolution)
{
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"), CommandLineSwitches.ParameterizedSwitch.Preprocess);
success = false;
}
else
{
Expand All @@ -1282,13 +1283,14 @@ internal static bool BuildProject(
}
}

if (isTargets)
if (isTargets && success)
{
success = false;

// TODO: Support /targets for solution files. https://github.com/dotnet/msbuild/issues/7697
if (isSolution)
{
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"), CommandLineSwitches.ParameterizedSwitch.Targets);
success = false;
}
else
{
Expand All @@ -1298,6 +1300,7 @@ internal static bool BuildProject(

if (!isPreprocess && !isTargets)
{
success = false;
BuildParameters parameters = new BuildParameters(projectCollection);

// By default we log synchronously to the console for compatibility with previous versions,
Expand Down