dotnet / sdk-container-builds

Libraries and build tooling to create container images from .NET projects using MSBuild

Home Page:https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Console applications should be able to be packaged by default

baronfel opened this issue · comments

The Container targets aren't imported by console applications in the base .NET SDK, and so the PublishContainer target isn't usable for them. We should push the Import of these props/targets down into the Base SDK so that multi-project orchestration scenarios and console publishing works.

I have been searching for the appropriate location, and I believe that the Microsoft.NET.Sdk.targets file is the one to which we should move our import. Additionally, if my memory serves me correctly, we intended to add IsPublishable AND EnableSdkContainerSupport to the import condition.

That sounds like a good location to me - and a big +1 on the EnableSdkContainerSupport flag as well. One thing to check - is the Publish SDK imported before or after the Microsoft.NET.Sdk.Targets? I ask because if we add EnableSdkContainerSupport checks, then we will want to make sure that the Publish SDK (which sets EnableSdkContainerSupport to true when imported) is still Imported before the Container targets' Condition is evaluated.