dotnet / dotnet/msbuild

msbuild /pp:out.xml emits empty file and no message on missing import

Open
#7,414 1 comment 1 reaction 0 assignees View on GitHub
Area: Logging bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

A regular build of a project with a missing import produces this:

> msbuild /t:prepareforbuild
> C:\VS.r\src\configdata\buildtargets\Microsoft.DevDiv.TextTemplating.15.0.targets(35,3): error MSB4019: The imported project "C:\build\Microsoft.TextTemplating.targets" was not found. Confirm that the expression in the Import declaration "\build\Microsoft.TextTemplating.targets" is correct, and that the file exists on disk. [C:\VS.r\src\env\shell\UnitTests\InfoBadgeTests\InfoBadgeTests.csproj]

But I have no idea how in the tree of imports this .targets file even gets attempted.
So I run `msbuild /pp:c:\temp\out.xml` to try to understand this. It produces no output to stdout or stderr. And the out.xml file has 0 length.

Not helpful at all. Can /pp be made to skip on missing imports and simply include a commented error message or something in the out.xml at the position of the import?
And logging a warning to stderr would be good too.

### Versions & Configurations

```
Microsoft (R) Build Engine version 17.2.0-preview-22116-01+7d926d7ab for .NET Framework
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.