Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will not publish containers for non-web projects #219

Closed
jaydeboer opened this issue Jun 7, 2024 · 3 comments · Fixed by #220
Closed

Will not publish containers for non-web projects #219

jaydeboer opened this issue Jun 7, 2024 · 3 comments · Fixed by #220

Comments

@jaydeboer
Copy link

jaydeboer commented Jun 7, 2024

🔥 Bug Description

Our application is a mixture of projects of <Project Sdk="Microsoft.NET.Sdk.Web"> and <Project Sdk="Microsoft.NET.Sdk"> types. All Microsoft.NET.Sdk project types display A publish profile with the name 'DefaultContainer' was not found in the project. Set the PublishProfile property to a valid file name. and do not push a container to the repository during aspirate build

🔍 Steps to Reproduce the Bug

  1. Have a <Project Sdk="Microsoft.NET.Sdk"> project referenced in your AppHost project.
  2. Run aspirate build
  3. See the error in the output of the command
  4. Try aspirate apply and no container will be running because it isn't in the repository.

🧯 Possible Solution

  • According to the README at the dotnet/sdk-container-builds there are two different commands, one for web project and a different one for non-web projects. I am guessing this is where the issue is coming from.
@jaydeboer
Copy link
Author

I've found that if you change the project type to <Project Sdk="Microsoft.NET.Sdk.Worker"> you can get around the issue.

@prom3theu5
Copy link
Owner

Seems like they fixed this in 8.0.200, so that all project types can now use /t:PublishContainer
dotnet/sdk-container-builds#141

I'll get it changed - cheers :)

@prom3theu5 prom3theu5 linked a pull request Jun 7, 2024 that will close this issue
@prom3theu5
Copy link
Owner

prom3theu5 commented Jun 7, 2024

This has just gone out in v8.0.4 (nuget in ten mins or so)

One thing you will have to do though for Sdk (console) apps.
You have to opt in to container support as per the docs here: https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container?pivots=dotnet-8-0

You don't need to add the containers nuget package as its backed into the sdk, but you have to add

<PropertyGroup>
  <IsPublishable>true</IsPublishable>
  <EnableSdkContainerSupport>true</EnableSdkContainerSupport>
</PropertyGroup>

CleanShot 2024-06-07 at 23 51 24

CleanShot 2024-06-07 at 23 52 04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants