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

Ad central package management #97

Merged
merged 1 commit into from
May 7, 2024
Merged

Ad central package management #97

merged 1 commit into from
May 7, 2024

Conversation

sebastienros
Copy link
Owner

No description provided.

<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />

<!-- Global Package References -->
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

PrivateAssets="all" probably has no effect here

Copy link
Owner Author

Choose a reason for hiding this comment

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

"here", do you mean because Microsoft.SourceLink.GitHub doesn't need it? GlobalPackageReference actually maintains it, had to learn since you taught me that it didn't have any effect in the PackageVersion tags. https://learn.microsoft.com/en-us/nuget/consume-packages/Central-Package-Management#global-package-references

Copy link
Owner Author

@sebastienros sebastienros May 7, 2024

Choose a reason for hiding this comment

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

And double-checked, SourceLink requires the PrivateAssets attribute (was obvious)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think I found the explanation:

Source Link package is a development dependency, which means it is only used during build. It is therefore recommended to set PrivateAssets to all on the package reference. This prevents consuming projects of your nuget package from attempting to install Source Link.
Referencing any Source Link package in a .NET SDK 8+ project suppresses Source Link that is included in the SDK.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, generally any <GlobalPackageReference> is kind of a fire-and-forget, it won't/shouldn't be present in actual package

Copy link
Collaborator

Choose a reason for hiding this comment

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

A reason I like to have them in a separate <ItemGroup> as they behave differently

Copy link
Owner Author

Choose a reason for hiding this comment

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

Keeping it, for safety

Copy link
Owner Author

Choose a reason for hiding this comment

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

https://grep.app/search?q=GlobalPackageReference%20Include%3D%22Microsoft.SourceLink.GitHub%22&filter[repo.pattern][0]=microsoft

Like you said. I asked internally to understand how it's done and what is the recommendation.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I only understand your comment now, fixing ...

@sebastienros sebastienros merged commit b3160ac into main May 7, 2024
2 checks passed
@sebastienros sebastienros deleted the sebros/deps branch May 7, 2024 17:46
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