-
Notifications
You must be signed in to change notification settings - Fork 1.4k
MSBuild v18 truncates configuration names with spaces when passing to Project References #13453
Description
Issue Description
When building a project or solution that contains Project References (<ProjectReference>), passing a Configuration property that contains a space (e.g., "Debug Unicode") results in the configuration name being truncated at the space when the properties are passed down to the referenced project.
The referenced project receives only the first word (e.g., "Debug"), which causes condition checks in Microsoft.CppBuild.targets to fail and throws an MSB8013 error. If all <ProjectReference> nodes are removed from the main project, it builds successfully, isolating the regression to the project reference resolution logic.
Steps to Reproduce
- Create a Visual Studio C++ Solution containing two projects (Project A and Project B).
- Add a Project Reference in Project A pointing to Project B.
- In both projects and the solution, define a custom configuration that includes a space (e.g.,
Debug Unicode|x64). - Open the Developer Command Prompt for Visual Studio 2026 (MSBuild v18).
- Run the following command:
msbuild MySolution.sln /p:Configuration="Debug Unicode" /p:Platform=x64 /bl:build.binlog
Expected Behavior
The full Configuration="Debug Unicode" property is successfully passed down to the referenced Project B, the PropertyGroup conditions match, and the entire build succeeds.
Actual Behavior
The build fails with error MSB8013 on Project B.
Upon inspecting the generated build.binlog using the MSBuild Structured Log Viewer, the AssignProjectConfiguration task (which resolves P2P references) shows that the configuration string was truncated. The referenced project's internal properties evaluate to _OriginalConfiguration = Debug instead of Debug Unicode. Because Project B receives Debug, the condition '$(Configuration)|$(Platform)'=='Debug Unicode|x64' fails, leaving $(ConfigurationType) empty and triggering the error.
Analysis
No response
Versions & Configurations
Environment:
- MSBuild version: 18.4.0.7901
- Visual Studio version: Visual Studio 2026 (v18.4.2)
- Operating System: Windows 11
Additional Context:
- Building the main project succeeds perfectly if the
<ProjectReference>items are removed, confirming that the initial command-line parsing handles the space correctly, but the P2P hand-off drops it.