[release/8.0.1xx] update warning message for containers package inclusion #40628
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.
This is a manual backport of the servicing-approved #39956 since the automated backport didn't apply cleanly.
We want to backport these changes because the 8.0.100 series is LTS and the only version supported by Source-Build, so without it many Linux users would have unintended errors when using the containers feature.
Description
We need to make the warning about removing the Microsoft.NET.Build.Containers NuGet package only fire when running in the context of an SDK that can actually package the kind of app being packaged (since this is still being pushed as a PackageReference as well as bundled into the SDK for certain project types).
Fixes #39931.
Customer Impact
Customers only get a warning if the SDK they are building containers with is actually capable of natively containerizing the kind of project they are building - this means that 8.0.100 SDK users (e.g. Linux distro installs) will only see this error for Web and Worker projects, never console apps. This is valuable because those users will rarely have access to an SDK that can natively target console apps during the 8 cycle, which is LTS.
Regression
Yes, this warning should not have been triggering for different kinds of projects in the different SDK bands - we have been errantly throwing this in different ways since 7.0.400.
Risk
Low, this makes a warning less likely to fire by removing the warning in situations where it is not applicable
Testing
Automated tests cover these scenarios already.