Feature request: allow -pp to produce some output even in presence of import and schema errors
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
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
1. Create a new C# project, e.g. `dotnet new console`
2. Add the following to the project:
```
```
3. `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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.