-
Notifications
You must be signed in to change notification settings - Fork 39
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
PublishProfile doesn't work out of the box for non-web projects #141
Comments
Most of my apps are Console based so looking forward to this |
We're planning to fix this in 7.0.300 by unifying the publish profile targets in the SDK across the project types. |
This is being tracked in dotnet/sdk#32422 - we need to get input from the Publish team about if this is safe to do. Once this is done, the publish gesture will be the same for all project types. |
Looks as duplicate of #402 |
@baronfel is there a way to containerize a console app using the .NET 8 SDK? |
yes - we document this in our Getting Started and a few other places, but you can add the
|
I have tried that using the rc1 and a dialy rc2 build (both built from source). Both say the
|
Does the console app have the package reference added? |
No, I missed that step, and I had assumed it would work with the built-in SDK container tooling. It is working when I add the package. |
Closing as the targets are available for all projects starting in 8.0.200. |
Is this tip in the docs resolved?
|
It will be when 8.0.200 releases next month - we'll be doing a pass on some of the docs at that time. |
Hi @baronfel I got the 8.0.200, how can I verify it is fixed? Also , it seems hard to me to find what the explanation of "/t:PublishContainer" . As you can see that the help doc for "dotnet publish" does not mention anything about the "/t:PublishContainer". Thank you |
/t is the MSBuild command line parameter to build a particular MSBuild target, that's all. PublishContainer is the name of the MSBuild target that actually builds and pushes the container. In previous versions, all the PublishProfile did was hide the fact that we were calling an MSBuild target under the hood - now this is less hidden and more clear. |
Thanks @baronfel for your timely reply. I have checked the MSBuild command args and did not find the "/t " parameter. Is it the "-target" or "-t" parameter? If yes, does it mean that in Windows OS, we can freely swap the "-" and "/" ? Also where can we find the available MSBuild targets? But I cannot see the PublishContainer as an available target, so I guess there might be an official doc for this? |
There's a paragraph on the MSBuild CLI docs that describe the various forms of the switches:
So yes, For discovering all of the available targets, you can use the
|
@baronfel thank you!! Is there a documentation on Microsoft Website for all of these MSBuild Targets?? Also, I found that I can only use the command "> dotnet msbuild -targets | select-string Container" in a folder which contains the .csproj file, not any other folders. Why? |
Not generally - targets can come from anywhere, and only targets that do not start with
That's actually exactly inverse - targets are only relevant to a project, just like all of MSBuild. It's just that for solution files, MSBuild creates a project file for the solution behind the scenes. |
thanks @baronfel for your explanation. Now, back to the unified publish experience. I have .NET 8.0.200, does this mean that I can remove the "/t:PublishContainer" and use the common "-p:PublishProfile=DefaultContainer" ? |
Exactly the inverse - PublishProfiles are not usable by all project types, instead you should use |
@baronfel Lmao, I got it totally opposite every time haha.
|
Good questions, and I'm happy to keep answering :)
|
Thank you so much @baronfel . I got all my questions answered. |
The default-fallback mechanism for PublishProfiles in the SDK doesn't work for non-web projects. We should fix this, otherwise console app users end up having to use
/t:PublishContainer
as the entrypoint, which we don't want from a uniformity of experience perspective.The text was updated successfully, but these errors were encountered: