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 that PrivateAssets="all" also affects Publish Fixes #3270 #3291

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Forgind
Copy link

@Forgind Forgind commented May 9, 2024

Fixes #3270

@Forgind Forgind requested review from a team as code owners May 9, 2024 19:17
Copy link

Learn Build status updates of commit dc80408:

✅ Validation status: passed

File Status Preview URL Details
docs/consume-packages/Package-References-in-Project-Files.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@@ -113,10 +113,16 @@ Allowable values for these tags are as follows, with multiple values separated b
| analyzers | .NET analyzers |
| native | Contents of the `native` folder |
| none | None of the above are used. |
| all | All of the above (except `none`) |
| all | All of the above (except `none`). Also turns off "Publish" by default. |
Copy link
Member

Choose a reason for hiding this comment

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

Is this documented anywhere on the SDK side?

Personally, I've always thought this was an incorrect decision that we unfortunately can't roll back, but it is still an SDK side decision, not NuGet. So I think the NuGet docs should reference an SDK side explanation.

Copy link
Author

Choose a reason for hiding this comment

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

I don't think it's documented anywhere. I'm not sure where the code that does this is, but I imagine most customers who are looking for something like PrivateAssets="all" will find the NuGet docs, so I think we do need to mention it here.

I don't know where I'd add that in any SDK docs, so although I'm not against having it there somewhere there and having a link to that here, I'd probably have to dig around a bit to find where an appropriate place might be—unless you already have somewhere in mind for that?

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 publish docs should have it.

Copy link
Author

Choose a reason for hiding this comment

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

Are you talking about https://learn.microsoft.com/dotnet/core/deploying/? I don't see anything that connects to how metadata (like PrivateAssets) would affect publishing...since that page was mostly talking about high-level things (what can you pass to the publish command), I feel like this would belong on a different page, but I didn't see anything better.

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 any doc that may be talking about publish actually does.

The PackageReference attribute Publish is a publish first thing, not a PackageReference first thing.
It never flows through the assets file.

PrivateAssets means what my consumers get, it never affects what gets consumed at build time. You can take a compile time or runtime dependency on a package that you've marked with PrivateAssets.
ExcludeAssets/IncludeAssets handle whether you're allowed to take that dependency.

Publish is different from build.

That being said, i think this discussion is related to dotnet/sdk#39400 now.

Copy link
Author

Choose a reason for hiding this comment

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

My understanding from that discussion is that this is still correct and unlikely to change. I couldn't find anywhere on the SDK side that documented any part of this scenario. Are you ok with merging this?

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 this pull request may close these issues.

2 participants