Skip to content

Move shared package references to Directory.Build.props#14

Merged
seesharprun merged 4 commits into
mainfrom
copilot/move-package-reference
Mar 19, 2026
Merged

Move shared package references to Directory.Build.props#14
seesharprun merged 4 commits into
mainfrom
copilot/move-package-reference

Conversation

Copilot AI commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Only packages shared across all samples belong in Directory.Build.props. Moving Microsoft.Azure.Cosmos, Newtonsoft.Json, and Microsoft.Extensions.Configuration.UserSecrets there keeps them inherited by all projects, while sample-specific packages remain as #:package directives in the script file.

Changes

  • Directory.Build.props — Added <ItemGroup> with PackageReference entries for Microsoft.Azure.Cosmos, Microsoft.Extensions.Configuration.UserSecrets, and Newtonsoft.Json (shared across samples; no versions specified, resolved via central Directory.Packages.props)
  • connect.cs — Removed #:package directives for the shared packages; only #:package Azure.Identity remains as it is specific to this sample

Before (connect.cs)

#:package Azure.Identity
#:package Microsoft.Azure.Cosmos
#:package Newtonsoft.Json
#:package Microsoft.Extensions.Configuration.UserSecrets

using Azure.Identity;
// ...

After (connect.cs)

#:package Azure.Identity

using Azure.Identity;
// ...

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: seesharprun <5067401+seesharprun@users.noreply.github.com>

@seesharprun seesharprun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I only want to put shared components in the Directory.Build.props file. For example, this is the only sample that would use Azure.Identity. If a library is only used in one sample, it should be embedded in the C# script file. If it's used in more than one sample, it's in the Directory.Build.props file.

Co-authored-by: seesharprun <5067401+seesharprun@users.noreply.github.com>

Copilot AI commented Mar 19, 2026

Copy link
Copy Markdown
Contributor Author

I only want to put shared components in the Directory.Build.props file. For example, this is the only sample that would use Azure.Identity. If a library is only used in one sample, it should be em...

Updated in ec85b13. Microsoft.Extensions.Configuration.UserSecrets stays in Directory.Build.props as it's shared across all samples. Azure.Identity, Microsoft.Azure.Cosmos, and Newtonsoft.Json are restored as #:package directives in connect.cs since they're specific to this sample.

Copilot AI changed the title Move package references from script directives to Directory.Build.props Move shared package reference to Directory.Build.props Mar 19, 2026
Copilot AI requested a review from seesharprun March 19, 2026 13:10

@seesharprun seesharprun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is wrong.

Microsoft.Azure.Cosmos, Newtonsoft.Json should be in the props file. Only Azure.Identity should be in the script file.

…y.Build.props

Co-authored-by: seesharprun <5067401+seesharprun@users.noreply.github.com>

Copilot AI commented Mar 19, 2026

Copy link
Copy Markdown
Contributor Author

This is wrong.

Microsoft.Azure.Cosmos, Newtonsoft.Json should be in the props file. Only Azure.Identity should be in the script file.

Fixed in a0f1caf. Microsoft.Azure.Cosmos and Newtonsoft.Json are now in Directory.Build.props alongside Microsoft.Extensions.Configuration.UserSecrets. Only #:package Azure.Identity remains in connect.cs.

Copilot AI changed the title Move shared package reference to Directory.Build.props Move shared package references to Directory.Build.props Mar 19, 2026
Copilot AI requested a review from seesharprun March 19, 2026 13:13
@seesharprun seesharprun marked this pull request as ready for review March 19, 2026 13:16
Copilot AI review requested due to automatic review settings March 19, 2026 13:16
@seesharprun seesharprun merged commit 590af87 into main Mar 19, 2026
9 checks passed
@seesharprun seesharprun deleted the copilot/move-package-reference branch March 19, 2026 13:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR centralizes common NuGet dependencies for the .NET samples by moving shared package references into dotnet/Directory.Build.props, while keeping sample-specific dependencies declared inline in the script.

Changes:

  • Added PackageReference entries for Cosmos SDK, UserSecrets, and Newtonsoft.Json to dotnet/Directory.Build.props (versions resolved via dotnet/Directory.Packages.props).
  • Removed the corresponding #:package directives from dotnet/001-connect-passwordless/connect.cs, leaving only Azure.Identity as an inline directive.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
dotnet/Directory.Build.props Adds global PackageReference entries intended to be inherited by .NET samples under dotnet/.
dotnet/001-connect-passwordless/connect.cs Removes inline package directives for packages now referenced via shared MSBuild props.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dotnet/Directory.Build.props
Comment thread dotnet/Directory.Build.props
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.

3 participants