msbuild does not build precompiled header before building source file if UseMultiToolTask=true and path to the pch.h is relative
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Issue Description
I have the following project:
```
pch.h
pch.cpp
test/in-sub-folder.cpp
Directory.Build.props
```
The content of the `Directory.Build.props` is
```xml
true
```
and the `test/in-sub-folder.cpp` file has a `#include "../pch.h"`
If I try to compile the project I get
```
03:08:37:193 Rebuild started at 03:08...
03:08:37:252 1>------ Rebuild All started: Project: TestCcache2, Configuration: Debug x64 ------
03:08:37:383 1>in-sub-folder.cpp
03:08:37:433 1>pch.cpp
03:08:37:433 1>F:\git_projects\TestCcache2\test\in-sub-folder.cpp(1,10): error C1083: Cannot open precompiled header file: 'TestCcache2\x64\Debug\TestCcache2.pch': No such file or directory
03:08:38:000 1>Done building project "TestCcache2.vcxproj" -- FAILED.
03:08:38:007 ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
03:08:38:007 ========== Rebuild completed at 03:08 and took 00,849 seconds ==========
```
### Steps to Reproduce
You can find an example project here: https://github.com/autoantwort/msbuild-bug-repro
### Expected Behavior
The file in the subfolder should be compiled after the precompiled header is compiled
### Actual Behavior
The file in the subfolder is compiled before the precompiled header is compiled
### Analysis
It seems that msbuild misses the dependency on the precompiled header file.
### Versions & Configurations
```
** Visual Studio 2022 Developer Command Prompt v17.12.4
C:\Program Files\Microsoft Visual Studio\2022\Professional>msbuild -version
MSBuild-Version 17.12.12+1cce77968 für .NET Framework
17.12.12.57101
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.