Deps.json should include project references that aren't present in project.assets.json #29095
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Port of #28963
Fixes #28891
When there is a reference to a project that is not included in the project.assets.json file for some reason (e.g. it has opted out of nuget restore), it does not get included into deps.json.
This fix is to include all references in the deps.json file even those not in the project.assets.json. In 7.0.2xx the change is on by default but for 6.0.4xx, we are leaving it as opt-in so as to reduce risk.
Customer Impact
While rare and not the default, this will result in the application not being able to find all of it's dependencies at runtime and fail to run. This particular case came because of using internal build tools when referencing a cppCLI project and those tools were disabling nuget restore for those projects by default.
Regression?
Risk
Verification
Port of #28963
Although most projects are included in project.assets.json after a restore takes place, there are some (rare) scenarios when this is not the case. When that happens, project references end up being skipped and excluded from deps.json.
One can work around this by adding a binary Reference, that is inconvenient and can lead to issues when one forgets. Instead, it would be good to check whether the project reference is included in project.assets.json before skipping it when generating the list of dependencies.
Also added a functional test (.NET 6.0 project referencing a .NET Framework project) that failed previously and succeeds now.
(Continues #28892, retargeting release/7.0.2xx)