Skip to content

[Issue 5395] Fix msbuild warnings #5685

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ssparach
Copy link
Contributor

@ssparach ssparach commented Aug 5, 2025

Summary

This PR attempts to fix the following msbuild warning:
warning MSB8027: Two or more files with the name of WindowsAppRuntimeAutoInitializer.cpp will produce outputs to the same location. This can lead to an incorrect build result.

This build warning seems to be caused by:
MSB4120: Item 'ClCompile' definition within target references itself via (qualified or unqualified) metadatum 'PreprocessorDefinitions'. This can lead to unintended expansion and cross-applying of pre-existing items. More info: https://aka.ms/msbuild/metadata-self-ref

This PR eliminates duplicate output by disabling MSBuild batching and applying PreProcessorDefinitions uniformly across all source files.

Testing

Confirmed that the warning no longer appears in the MSBuild binlog during repro testing.
Pipeline builds


A microsoft employee must use /azp run to validate using the pipelines below.

WARNING:
Comments made by azure-pipelines bot maybe inaccurate.
Please see pipeline link to verify that the build is being ran.

For status checks on the main branch, please use TransportPackage-Foundation-PR
(https://microsoft.visualstudio.com/ProjectReunion/_build?definitionId=81063&_a=summary)
and run the build against your PR branch with the default parameters.

@ssparach ssparach changed the title Fix msbuild warnings [Issue 5395] Fix msbuild warnings Aug 5, 2025
@ssparach ssparach requested a review from Scottj1s August 5, 2025 16:59
@ssparach
Copy link
Contributor Author

ssparach commented Aug 5, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ssparach
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ssparach
Copy link
Contributor Author

/azp run

@ssparach ssparach marked this pull request as ready for review August 14, 2025 23:28
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ssparach ssparach requested a review from Scottj1s August 18, 2025 17:00
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="WindowsAppRuntimeAutoInitializerPreprocessorDefinitions">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: now that we understand root cause, we could simplify by calculating the preprocessor definitions in situ, like we do with GenerateUndockedRegFreeWinRTCpp

@ssparach ssparach force-pushed the user/ssparach/fixBuildWarnings branch from 8635895 to d418f2c Compare August 19, 2025 17:17
@ssparach
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ssparach
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ssparach ssparach requested a review from manodasanW August 19, 2025 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

warning MSB8027: Two or more files with the name of WindowsAppRuntimeAutoInitializer.cpp will produce outputs to the same location.
2 participants