Skip to content

Fix Microsoft.SourceLink.GitHub incorrectly surfacing as a runtime dependency#994

Merged
jsquire merged 2 commits intomainfrom
copilot/fix-source-link-runtime-dependency
Mar 2, 2026
Merged

Fix Microsoft.SourceLink.GitHub incorrectly surfacing as a runtime dependency#994
jsquire merged 2 commits intomainfrom
copilot/fix-source-link-runtime-dependency

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

The 2.9.0 CPM migration moved PrivateAssets="All" from the PackageReference in src/OpenAI.csproj to the PackageVersion in Directory.Packages.props. NuGet does not honor PrivateAssets on PackageVersion during pack, so Microsoft.SourceLink.GitHub (and its transitive deps Microsoft.SourceLink.Common, Microsoft.Build.Tasks.Git) leaked into the published .nuspec as runtime dependencies — breaking any consumer build with:

error : Source control information is not available - the generated source link is empty.

Changes

  • src/OpenAI.csproj: Restore PrivateAssets="All" directly on the PackageReference for Microsoft.SourceLink.GitHub, where NuGet actually honors it during pack.
  • CHANGELOG.md: Document the fix under 2.10.0-beta.1 (Unreleased).
Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] 2.9.0 added Microsoft.SourceLink.GitHub as a runtime dependency</issue_title>
<issue_description>### Describe the bug

2.8.0:
Image

2.9.0:
Image

This is not only a deployment issue, it also breaks builds.

In PR #890, the migration to Central Package Management moved PrivateAssets="All" from the PackageReference in src/OpenAI.csproj to the PackageVersion in Directory.Packages.props. However, NuGet does not honor PrivateAssets on PackageVersion when generating the nuspec for packing — it must be on the PackageReference itself.

As a result, Microsoft.SourceLink.GitHub 10.0.102 (and its transitive dependencies Microsoft.SourceLink.Common and Microsoft.Build.Tasks.Git) appear as regular dependencies of the OpenAI package. Any project that consumes OpenAI 2.9.0 gets SourceLink's MSBuild targets injected into its build. These targets attempt to generate source link metadata and fail with:

error : Source control information is not available - the generated source link is empty.

cc: @jsquire, @joseharriaga

Steps to reproduce

Use the OpenAI library as a dependency.

Code snippets

OS

All

.NET version

Any

Library version

2.9.0</issue_description>

<agent_instructions>- Be sure to add a change log entry to accompany any changes, following existing patterns

  • Validate all assumptions and conclusions with data from an authoritative source
  • Do research within the local context and on the internet to collect data
  • If you lack data to validate, tell me what you don't know.
  • IMPORTANT: Do not speculate
  • IMPORTANT: Do not hallucinate
  • IMPORTANT: Follow all repository instructions and conventions rigidly</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI changed the title [WIP] Fix Microsoft.SourceLink.GitHub runtime dependency issue Fix Microsoft.SourceLink.GitHub incorrectly surfacing as a runtime dependency Mar 2, 2026
@jsquire jsquire marked this pull request as ready for review March 2, 2026 17:19
@jsquire jsquire merged commit e3ad790 into main Mar 2, 2026
4 checks passed
@jsquire jsquire deleted the copilot/fix-source-link-runtime-dependency branch March 2, 2026 18:11
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.

[BUG] 2.9.0 added Microsoft.SourceLink.GitHub as a _runtime_ dependency

4 participants