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

Specify self-contained for .NET 6. #340

Closed
scovetta opened this issue Jun 25, 2022 · 7 comments · Fixed by #347
Closed

Specify self-contained for .NET 6. #340

scovetta opened this issue Jun 25, 2022 · 7 comments · Fixed by #347

Comments

@scovetta
Copy link
Member

.NET 6 introduced a change that requires self-contained to be explicitly specified if runtimeIdentifiers are too.

Details at: https://docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/6.0/runtimeidentifier-self-contained

We might need to include <SelfContained>false</SelfContained> in each of the tool .csproj files, or change the arguments in the Pipelines/templates/dotenet-build-publish-all-platforms-job.yml file.

@gfs
Copy link
Contributor

gfs commented Jun 28, 2022

Is there something currently not working?

--sc is specified in the pipeline

it's not documented on docs.Microsoft.com for the publish command but that should be the same as --self-contained true.

arguments: '${{ parameters.solutionPath }} -c ${{ parameters.buildConfiguration }} -o bin/win/${{ parameters.projectName }}_win_$(ReleaseVersion) --sc -r win-x64 --no-build'

See these issue for sort of documentation on --sc

dotnet/sdk#21405

dotnet/sdk#19681

@gfs
Copy link
Contributor

gfs commented Jun 28, 2022

Filed an issue to update docs.Microsoft.com.

dotnet/docs#30025

@gfs
Copy link
Contributor

gfs commented Jun 28, 2022

Filed an issue to update docs.Microsoft.com.

dotnet/docs#30025

Docs have been updated to document the --sc flag.

@scovetta
Copy link
Member Author

This is the warning I'm seeing in the build logs:

image

@gfs
Copy link
Contributor

gfs commented Jun 28, 2022

This is the warning I'm seeing in the build logs:

image

Got it I might have missed one of the publish commands. Will make a scrub of the pipeline.

@gfs
Copy link
Contributor

gfs commented Jun 28, 2022

It looks like this is caused by the "build" commands which happen before "publish". These build commands also have a rid.

I don't know why there are build commands at all. Do you know why the pipeline does this? Per dotnet documentation and my experience you only need to (and only should) publish for distribution. "Build" doesn't produce assets that are expected to be distributed.

This is the first of the 3 build commands. After the 3 builds there are 4 publishes.

From dotnet documentation:

The dotnet publish command's output is ready for deployment to a hosting system (for example, a server, PC, Mac, laptop) for execution. It's the only officially supported way to prepare the application for deployment.

https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish

I could either:
Add self contained to these build commands
Remove the build commands

I'm leaning towards 2 unless there is a specific non standard thing we are doing that requires them. If there is I'd like to document what what the extra commands are for in the pipeline as well.

@gfs
Copy link
Contributor

gfs commented Jun 28, 2022

I remember now there was some kind of effort to not duplicate some shared assets between the projects. Perhaps that was the motivation?

Can you remind me what the desired behavior of the build is and I can run some tests locally to figure out the right combination.

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