PreCompiledHeaderFile property is always `stdafx.h`
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
### Steps to reproduce
Using `Microsoft.Build.Execution.ProjectInstance` the PreCompiledHeaderFile property is always `stdafx.h` even if a different name is explicitly set. Below is a project file with `pch.{h, cpp}` instead of `stdafx.{h, cpp}`
```xml
Release
x64
{2F4689AC-87CD-4E7E-0000-270C502B3B07}
..
DynamicLibrary
v141
Unicode
<_ProjectFileVersion>11.0.50727.1
pch.h
MachineX64
Create
```
To reproduce, construct an instance with that vcxproj and extract the PreCompiledHeaderFile property:
```powershell
Add-Type -Path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\Microsoft.Build.dll'
$broken = [Microsoft.Build.Execution.Projectinstance]'C:\broken.vcxproj'
$broken.ItemDefinitions |
where ItemType -eq 'ClCompile' |
foreach Metadata |
where Name -eq 'PreCompiledHeaderFile' |
foreach EvaluatedValue
```
### Expected behavior
Should return 'pch.h'
### Actual behavior
Returns 'stdafx.h'
### Environment data
`msbuild /version` output:
```
Microsoft (R) Build Engine version 15.5.180.51428 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
15.5.180.51428
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided C:\broken.vcxproj and the Microsoft.Build.Execution.ProjectInstance evaluation path; run the PowerShell reproduction against the stated MSBuild version. Trace how the ClCompile PrecompiledHeaderFile item definition is evaluated, and consider the issue done when the extracted EvaluatedValue is pch.h rather than stdafx.h.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100