-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Issue Description
The -pp or -preprocess will produce no output if the project experiences schema or import errors. In the past, this was acceptable as you could usually just fix the error in question. However, the new PackageReference and Sdk mechanisms often result in a situation where one error in the project will cause package restore to fail, but if that error is not syntactic or schematic, the only diagnostics reported by msbuild will be for the failed Sdk or PackageReference import. This makes debugging the /t:restore target very difficult, as we have no way to see what the project looks like to msbuild when it runs the restore target.
This motivates a need for -pp to function with incomplete projects -- where either the Imports fail, or where errors are caused by incorrect property values (e.g. UsingTask can fail with syntax errors if the task factory value is set wrong, due to improperly initialized properties).
Steps to Reproduce
- Create a new C# project, e.g.
dotnet new console - Add the following to the project:
<ItemGroup> <PackageReference Include="Microsoft.NoSuchProject" Version="1.0.0" GeneratePackagePath="true" /> </ItemGroup> <Import Project="$(PkgMicrosoft_NoSuchProject)" /> dotnet /pp
Expected Behavior
Syntax errors, and partial result of preprocessing (at least up until the first error. Preferably preprocessed exactly as the /t:restore project would see the project.
Actual Behavior
No output at all.
Analysis
n/a
Versions & Configurations
C:\scratch\repro>dotnet --version
6.0.100-preview.1.21103.13
C:\scratch\repro>ver
Microsoft Windows [Version 10.0.19042.804]
Attach a binlog
n/a