Skip to content

[Issue 5395] Fix msbuild warnings - #5685

Merged
ssparach merged 6 commits into
mainfrom
user/ssparach/fixBuildWarnings
Aug 26, 2025
Merged

ssparach merged 6 commits into
mainfrom
user/ssparach/fixBuildWarnings

Conversation

@ssparach

@ssparach ssparach commented Aug 5, 2025 •

Copy link
Copy Markdown
Contributor

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 commented Aug 5, 2025

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@ssparach

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@ssparach

Copy link
Copy Markdown
Contributor Author

/azp run

@ssparach
ssparach marked this pull request as ready for review August 14, 2025 23:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

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

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@ssparach

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@ssparach

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@Scottj1s Scott Jones (Scottj1s) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@ssparach
ssparach merged commit 1d825e6 into main Aug 26, 2025
@ssparach
ssparach deleted the user/ssparach/fixBuildWarnings branch August 26, 2025 18:50
shisan (qiutongMS) added a commit that referenced this pull request Aug 27, 2025
@qiutongMS

shisan (qiutongMS) commented Aug 27, 2025 •

Copy link
Copy Markdown
Contributor

We found that this PR blocked the foundation version update in winUI. I am also trying to resolve this warning, we can discuss the details through Teams.

@Scottj1s

Copy link
Copy Markdown
Member

We found that this PR blocked the foundation version update in winUI. I am also trying to resolve this warning, we can discuss the details through Teams.

No worries. chatted with Sarah and devised a better technique that should be compatible with Xaml's generated code behavior.

Essentially, this should ensure that any auto-initializer preprocessor definitions are added after ALL compilation sources (to ensure no batching occurs):

<Target Name="AddUndockedRegFreeWinRTCppDefines" BeforeTargets="ClCompile" AfterTargets="$(BeforeClCompileTargets);$(ComputeCompileInputsTargets);MakeDirsForCl" >

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.

3 participants