Skip to content

chore: support local NuGet source via NOSCORE_LOCAL_PACKAGES env var#3

Merged
erwan-joly merged 1 commit into
masterfrom
revert-nuget-local-source
Apr 24, 2026
Merged

chore: support local NuGet source via NOSCORE_LOCAL_PACKAGES env var#3
erwan-joly merged 1 commit into
masterfrom
revert-nuget-local-source

Conversation

@erwan-joly

@erwan-joly erwan-joly commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds Directory.Build.props with a conditional RestoreAdditionalProjectSources that activates only when NOSCORE_LOCAL_PACKAGES is set.
  • No runtime cost for contributors who don't opt in — the property group is skipped, restore uses nuget.org only.
  • To use: setx NOSCORE_LOCAL_PACKAGES C:\LocalPackages, restart shell/VS, drop .nupkg files into the folder. Replaces the earlier NuGet.config-based attempt, which broke restore (NU1301) whenever the env var was unset.

Test plan

  • dotnet restore succeeds with NOSCORE_LOCAL_PACKAGES unset.
  • dotnet restore with NOSCORE_LOCAL_PACKAGES pointing to a folder with a .nupkg picks it up.

Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 655c98ed-330d-423b-ba63-615d4a396814

📥 Commits

Reviewing files that changed from the base of the PR and between b5c7d15 and 064cfeb.

📒 Files selected for processing (2)
  • Directory.Build.props
  • NuGet.config
💤 Files with no reviewable changes (1)
  • NuGet.config

Walkthrough

The pull request modifies NuGet package source configuration. A new Directory.Build.props file enables conditional local package source management via the NOSCORE_LOCAL_PACKAGES property, while NuGet.config removes a hardcoded local package source entry.

Changes

Cohort / File(s) Summary
NuGet Configuration
Directory.Build.props, NuGet.config
Directory.Build.props (new) adds conditional MSBuild property to extend RestoreAdditionalProjectSources when NOSCORE_LOCAL_PACKAGES is set. NuGet.config removes the local package source entry, retaining only the nuget.org source.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: reverting a previous addition that configured a local NuGet source using NOSCORE_LOCAL_PACKAGES, and clearly explains the reason (breaks restore when env var is unset).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-nuget-local-source

Comment @coderabbitai help to get the list of available commands and usage tips.

Putting the local source in NuGet.config as %NOSCORE_LOCAL_PACKAGES%
fails NU1301 on restore when the env var is unset (CI runners, fresh
clones) because NuGet treats the literal %VAR% as a path.

Move the wiring to Directory.Build.props with a Condition that only
adds RestoreAdditionalProjectSources when the env var is set. Devs who
want local packages just set NOSCORE_LOCAL_PACKAGES; everyone else is
unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@erwan-joly erwan-joly force-pushed the revert-nuget-local-source branch from c6e723d to 064cfeb Compare April 24, 2026 03:17
@erwan-joly erwan-joly changed the title Revert: local NuGet source via NOSCORE_LOCAL_PACKAGES breaks restore when env var is unset chore: support local NuGet source via NOSCORE_LOCAL_PACKAGES env var Apr 24, 2026
@erwan-joly erwan-joly merged commit 0f07906 into master Apr 24, 2026
2 checks passed
@erwan-joly erwan-joly deleted the revert-nuget-local-source branch April 24, 2026 03:19
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.

1 participant