Skip to content

Conversation

@MichalPavlik
Copy link
Member

@ghost ghost added Area-WebSDK untriaged Request triage from a team member labels Nov 21, 2023
@MichalPavlik
Copy link
Member Author

@baronfel, we have CheckContainersPackage target checking Microsoft.NET.Build.Containers package presence. Should I move it too? This check is for users using nuget package which supported only web apps.

Comment on lines 62 to 67
Condition="'$(EnableSdkContainerSupport)' == 'true' AND Exists('$(MSBuildThisFileDirectory)..\..\..\Containers\build\Microsoft.NET.Build.Containers.props')" />

<Import Project="$(_ContainersTargetsDir)Microsoft.NET.Build.Containers.targets"
Condition="'$(EnableSdkContainerSupport)' == 'true'
AND Exists('$(_ContainersTargetsDir)Microsoft.NET.Build.Containers.targets')
AND '$(TargetFramework)' != ''" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to remove EnableSdkContainerSupport from these conditions, and instead put that condition on the PublishContainer target directly - this will enable someone to call -t:PublishContainer at the solution level and have the target be available (but not enabled) for all projects.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I wanted to avoid importing these files when publishing is not required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an example of a scenario that should become possible after we move the Container targets into the base SDK:

  • myapp.sln
    • myapp.lib.csproj
    • myapp.web.csproj (references myapp.lib)
    • myapp.cli.csproj (references myapp.lib, has manually set EnableSdkContainerSupport to true)
    • myapp.tests.csproj (references myapp.lib)

We should be able to run dotnet publish -t:PublishContainer on myapp.sln and get containers generated for myapp.web and myapp.cli as a result.

@baronfel baronfel added the Area-Containers Related to dotnet SDK containers functionality label Nov 28, 2023
@baronfel
Copy link
Member

@MichalPavlik once we merge this we'll need to backport to release/8.0.2xx.

@baronfel
Copy link
Member

This looks correct and great to me - I'd like some level of scenario test to show folks that it does work, and then after merge I can look at updating docs and other resources to talk about the property.

@MichalPavlik MichalPavlik marked this pull request as ready for review December 5, 2023 15:29
@MichalPavlik MichalPavlik requested review from a team and vijayrkn as code owners December 5, 2023 15:29
Copy link
Member

@baronfel baronfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the addition of the test showing how it all works, I'm very happy to approve this PR! Thanks for plumbing it through @MichalPavlik!

@baronfel baronfel enabled auto-merge December 5, 2023 15:37
@baronfel baronfel merged commit 9eaea9b into main Dec 5, 2023
@baronfel baronfel deleted the dev/mipavlik/contsinares-enable-cli-projects branch December 5, 2023 16:40
@baronfel
Copy link
Member

baronfel commented Dec 5, 2023

/backport to release/8.0.2xx

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2023

Started backporting to release/8.0.2xx: https://github.com/dotnet/sdk/actions/runs/7103894377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Containers Related to dotnet SDK containers functionality Area-WebSDK untriaged Request triage from a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console applications should be able to be packaged by default

3 participants