<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye" -->

---
title: NuGet Configuration File inheritance is awesome | daily.dev
description: NuGet configuration files support inheritance: clients walk up the directory tree from the current folder to the drive root, then check user, IDE-specific, and...
canonical: https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: NuGet Configuration File inheritance is awesome | daily.dev
og:description: NuGet configuration files support inheritance: clients walk up the directory tree from the current folder to the drive root, then check user, IDE-specific, and...
og:url: https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye
og:image: https://api.daily.dev/og/posts/msVyKJSye.png
og:image:alt: NuGet Configuration File inheritance is awesome
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# NuGet Configuration File inheritance is awesome

**[Maarten Balliauw](https://daily.dev/sources/maartenballiauw)** · 4 min read · 0 upvotes · 0 comments

## Summary

NuGet configuration files support inheritance: clients walk up the directory tree from the current folder to the drive root, then check user, IDE-specific, and machine-wide config files, with the first file found for a given setting winning. This enables scenarios like shipping project-specific NuGet.config files in source control to set private feeds, blocking nuget.org, preventing accidental pushes to nuget.org by setting a DefaultPushSource, configuring default proxy credentials, and aggregating multiple customer-specific feeds using the activePackageSource 'Aggregate source' setting. Several concrete XML config examples are provided for each scenario.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.maartenballiauw.be/posts/2014-03-11-nuget-configuration-file-inheritance-is-awesome>

## Questions this post answers

### How does NuGet decide which NuGet.config file to use when there are multiple config files in different folders?

NuGet clients walk from the current directory up to the drive root checking for a NuGet.config at each level, then fall back to the user-specific config under %AppData%\NuGet\NuGet.config, then IDE-specific config files under %ProgramData%\NuGet\Config, and finally the machine-wide NuGetDefaults.config. The file consulted first wins for any given setting, so a project-level NuGet.config next to the .sln file takes priority over parent folder or global settings.

_Developers wiring up multi-project NuGet feeds can revisit config precedence details on daily.dev._

### How do I stop developers from accidentally pushing packages to nuget.org instead of our private feed?

Add a NuGet.config file next to the solution file with a config section setting DefaultPushSource to the internal feed's push URL, for example https://www.myget.org/F/chucknorris/api/v2/package. This way nuget.exe push defaults to the internal feed even if a developer forgets to pass the -Source parameter, preventing accidental pushes of internal frameworks to the public feed.

_Teams guarding against accidental public pushes can keep private feed setups straight via daily.dev._

### Why does NuGet package restore fail to find a package even though multiple feeds are configured in nested NuGet.config files?

This happens because the active package source is set to one specific feed rather than the aggregate of all configured feeds across the inherited NuGet.config files. The fix is adding an activePackageSource entry with key 'All' and value '(Aggregate source)' in a parent NuGet.config, such as one placed in the shared Projects folder, so restore searches every configured feed.

_Anyone debugging missing-package restore errors across nested feeds can dig into this on daily.dev._

## Similar posts on daily.dev

- [WinGet Configuration: Set up your dev machine in one command](https://daily.dev/posts/winget-configuration-set-up-your-dev-machine-in-one-command-unjifqctw) · DevBlogs · 0 upvotes · 0 comments
- [The Complete Guide to Creating NuGet Packages in .NET](https://daily.dev/posts/the-complete-guide-to-creating-nuget-packages-in-net-4carsceoo) · We Are .NET · 0 upvotes · 0 comments
- [Before You Start a .NET Web API, Add These 3 Files](https://daily.dev/posts/before-you-start-a-net-web-api-add-these-3-files-yfqv8ww9z) · Waseem .NET Newsletter · 16 upvotes · 1 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#visual-studio](https://daily.dev/tags/visual-studio), [#nuget](https://daily.dev/tags/nuget)

[View this post on daily.dev](https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"NuGet Configuration File inheritance is awesome","url":"https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye"},"datePublished":"2026-10-04T13:04:29.486Z","dateModified":"2026-10-04T13:08:50.642Z","description":"NuGet configuration files support inheritance: clients walk up the directory tree from the current folder to the drive root, then check user, IDE-specific, and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3cbc64784c326bfd70856d02ed43004f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3cbc64784c326bfd70856d02ed43004f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Maarten Balliauw","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Maarten Balliauw","logo":"https://media.daily.dev/image/upload/s--rOTg3VYO--/f_auto,q_auto/v1791119043/logos/maartenballiauw?_a=BAMAMicg0","url":"https://daily.dev/sources/maartenballiauw"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,visual-studio,nuget","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Maarten Balliauw","item":"https://daily.dev/sources/maartenballiauw"},{"@type":"ListItem","position":3,"name":"NuGet Configuration File inheritance is awesome"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/nuget-configuration-file-inheritance-is-awesome-msvykjsye#faq","mainEntity":[{"@type":"Question","name":"How does NuGet decide which NuGet.config file to use when there are multiple config files in different folders?","acceptedAnswer":{"@type":"Answer","text":"NuGet clients walk from the current directory up to the drive root checking for a NuGet.config at each level, then fall back to the user-specific config under %AppData%\\NuGet\\NuGet.config, then IDE-specific config files under %ProgramData%\\NuGet\\Config, and finally the machine-wide NuGetDefaults.config. The file consulted first wins for any given setting, so a project-level NuGet.config next to the .sln file takes priority over parent folder or global settings. Developers wiring up multi-project NuGet feeds can revisit config precedence details on daily.dev."}},{"@type":"Question","name":"How do I stop developers from accidentally pushing packages to nuget.org instead of our private feed?","acceptedAnswer":{"@type":"Answer","text":"Add a NuGet.config file next to the solution file with a config section setting DefaultPushSource to the internal feed's push URL, for example https://www.myget.org/F/chucknorris/api/v2/package. This way nuget.exe push defaults to the internal feed even if a developer forgets to pass the -Source parameter, preventing accidental pushes of internal frameworks to the public feed. Teams guarding against accidental public pushes can keep private feed setups straight via daily.dev."}},{"@type":"Question","name":"Why does NuGet package restore fail to find a package even though multiple feeds are configured in nested NuGet.config files?","acceptedAnswer":{"@type":"Answer","text":"This happens because the active package source is set to one specific feed rather than the aggregate of all configured feeds across the inherited NuGet.config files. The fix is adding an activePackageSource entry with key 'All' and value '(Aggregate source)' in a parent NuGet.config, such as one placed in the shared Projects folder, so restore searches every configured feed. Anyone debugging missing-package restore errors across nested feeds can dig into this on daily.dev."}}]}
```

