Does NuGet Work in China? Data Residency, ICP & Cross-Border Rules
Your private NuGet packages are proprietary .NET code that often embeds API keys and connection strings. On nuget.org — Microsoft's offshore public gallery — or an offshore private feed, that code and those secrets sit abroad, and your China build's dependency supply chain runs cross-border: a data-residency and PIPL question, not a reachability one. NuGet supports private, self-hosted feeds, so an in-country private feed keeps them resident.
Does NuGet work in China?
Whether NuGet works in China is a data-residency and software-supply-chain question, not a reachability one. Public open-source packages resolving from Shanghai is the easy half; what decides the compliance question is your private packages.
Your organization's private, scoped NuGet packages are proprietary .NET source code — trade secrets — and they routinely embed API keys, access tokens and connection strings. Hosted on nuget.org, Microsoft's offshore public gallery, or on any offshore private feed, that concentrated code and those live secrets sit abroad, and the dependency supply chain feeding your China build runs across the border — a cross-border transfer under PIPL, with a Cybersecurity Law in-country storage duty (Article 39 (formerly Article 37)) for a critical information infrastructure operator or large-volume handler that offshore infrastructure cannot meet.
The lever: NuGet supports private, self-hosted feeds, so a self-hosted in-country private feed keeps your proprietary code and embedded secrets resident. This is a risk map, not a verdict — confirm your obligations with counsel. Our China team can map your private-package exposure →
What NuGet's own documentation says about China
| Fact | Primary source |
|---|---|
| In Microsoft's own .NET documentation, nuget.org is the public gallery. The Overview of NuGet.org states: "NuGet.org is a public host of NuGet packages," and "In its role as a public host, NuGet.org itself maintains the central repository of over 100,000 unique packages at nuget.org." It is operated offshore by Microsoft, with no mainland-China host named (confirm current hosting with the vendor). | Microsoft Learn — Overview of NuGet.org (learn.microsoft.com/nuget), retrieved 2026-10-13 |
| Microsoft's docs also document the private, self-hosted path. The same overview states the NuGet technology "also enables you to host packages privately in the cloud (such as on Azure DevOps), on a private network, or even on just your local file system," and the hosting guide says "NuGet supports setting up private package sources," including a "local HTTP server" and self-hostable servers you run yourself (a NuGet server, Sonatype Nexus or JFrog Artifactory). Any can run on in-country infrastructure. | Microsoft Learn — Overview of NuGet.org and Overview of Hosting Your Own NuGet Feeds (learn.microsoft.com/nuget), retrieved 2026-10-13 |
| Personal data that rides along with your packages — identifiers in test fixtures, contributor identities in package and publishing metadata — held on an offshore feed, together with a China build pulling dependencies across the border, is a cross-border transfer under the Personal Information Protection Law (Articles 38–40): the handler must give notice, obtain separate consent, and clear one transfer mechanism — a CAC security assessment, the CAC standard contract, or certification. | Personal Information Protection Law of the PRC, Articles 38–40 — see 21YunBox: cross-border data transfers under PIPL, retrieved 2026-10-13 |
| For a critical information infrastructure operator or large-volume handler, personal information and important data collected in China must be stored in the mainland — the Cybersecurity Law's data-localization rule, Article 39 (formerly Article 37) as renumbered by the 2025 amendment in force 2026-01-01 — a duty an offshore private feed cannot meet. | Cybersecurity Law of the PRC, Article 39 (formerly Article 37) — see 21YunBox: China's Cybersecurity Law and data localization, retrieved 2026-10-13 |
Sources verified by the 21YunBox compliance team on 2026-10-13.
For a mainland-China operation, the deciding question about NuGet is not whether dotnet restore can pull a public package from Shanghai — the open-source gallery resolving quickly is the easy, uninteresting half. What settles whether your setup is defensible is your private packages. Your organization’s private, scoped NuGet packages are proprietary .NET source code — trade secrets — and they routinely embed API keys, access tokens and connection strings, with the occasional personal record baked into a test fixture. Push those to nuget.org, Microsoft’s hosted public gallery, or to any offshore private feed, and that concentrated intellectual property and those live secrets sit outside the mainland — and the dependency supply chain feeding your China build runs across the border. Residency and cross-border transfer, not restore latency, decide this.
Does NuGet work in China? At a glance
| What decides it | What it means for mainland China |
|---|---|
| What your private packages hold | Private, scoped packages are proprietary .NET code — a concentrated trade secret — and routinely embed API keys, access tokens and connection strings, with the occasional personal record in a test fixture. |
| Where the public gallery runs | nuget.org is Microsoft's hosted public gallery, operated offshore; its documentation names no mainland-China host (confirm current hosting with Microsoft). |
| Where private packages live | Pushed to nuget.org or a vendor's offshore private feed, that concentrated code and those live secrets sit outside the mainland — a residency and trade-secret exposure. |
| Your China build's supply chain | The dependencies entering your China deployment — and their provenance and integrity — cross the border on every restore, so your software supply chain is cross-border by default. |
| Data residency | For a CIIO or large-volume handler, personal information and important data collected in China must be stored in the mainland (Cybersecurity Law Article 39 (formerly Article 37)) — a duty offshore infrastructure cannot meet. |
| The residency lever | NuGet supports private, self-hosted feeds. Run a self-hosted NuGet server, Nexus or Artifactory in-country and your proprietary code, artifacts and embedded secrets stay resident. |
Door one — your private NuGet packages are proprietary code, and residency follows where the feed runs
Start with what the private feed holds, because that is what China’s law answers to. A public mirror of community dependencies is not the point; your private, scoped packages are. They are the authoritative store of your proprietary .NET code — the libraries, build outputs and release packages you do not publish — and they routinely carry baked-in API keys, access tokens and connection strings, plus whatever personal data finds its way into a test fixture or sample payload. That is a concentrated slice of your intellectual property sitting in one place.
Push that to nuget.org, Microsoft’s hosted public gallery, or to an offshore private feed, and the concentrated IP and the live secrets live outside the mainland; by Microsoft’s published materials there is no mainland-China host (something to confirm with Microsoft directly rather than assume). If you are a critical information infrastructure operator, or you handle personal information at volume, personal information and important data collected and generated in China must be stored in the mainland — the Cybersecurity Law data-localization rule, Article 39 (formerly Article 37) as renumbered by the 2025 amendment in force 2026-01-01. Offshore infrastructure has no mainland footing to satisfy that.
Door two — your dependency supply chain, and the personal data riding along, run cross-border
The second door is the supply chain and the personal data inside it. On every build, your China deployment resolves dependencies from a feed — what code enters the deployment, and with what provenance and integrity, is decided wherever that feed lives. Run the private feed offshore and that supply chain is cross-border by default. Alongside the binaries, the feed and its metadata carry personal information: identifiers in test fixtures, and contributor identities in package and publishing metadata. Under the Personal Information Protection Law, holding that data on infrastructure outside the mainland is a cross-border transfer (Articles 38–40): the handler must give notice, obtain a separate consent for the transfer, and clear one mechanism — a CAC security assessment, the CAC standard contract, or certification. Minimizing the personal data that enters fixtures and metadata is part of the fix, but it does not move the feed on its own.
Why a reachability check misses this
A “can my build restore packages from Shanghai” test answers the wrong question. Standing up a public-package mirror or cache so community dependencies resolve quickly is a legitimate supply-chain convenience — but it does not change where your private feed, your artifacts and your secrets actually live, and it does not move your build’s dependency supply chain in-country. A reachability probe never sees that your proprietary packages and embedded credentials sit on an offshore registry, nor the notice-consent-and-mechanism duties that attach to the China personal data inside them. So a setup can look perfectly healthy from inside China while every private package, every baked-in secret and every contributor record still sits offshore. We publish no first-party measurement of NuGet restore performance from inside China, so we put no figures here; it is something we would measure against your actual feeds rather than assert.
This is a risk map, not a verdict: whether you need in-country storage, a transfer mechanism, a reworked consent flow, an ICP filing for any public-facing developer portal, or some combination depends on what your private packages and pipeline carry, how much, and who your contributors are — worth settling with counsel before you build.
The lever — map, localize, deliver
Because NuGet supports private, self-hosted feeds, there is a genuine in-country path, and 21YunBox never uses or suggests any form of circumvention.
- Map — inventory which of your packages and artifacts are private (your proprietary code), whether they embed secrets, where that private feed is hosted today, the residency basis, and your China build’s dependency supply chain.
- Localize / govern — run the private feed and artifact store in-country (self-hosted — a self-hosted NuGet server, Nexus or Artifactory), so proprietary code and embedded secrets stay resident; keep your China build’s supply chain in-country; minimize the personal data that enters fixtures and metadata; and govern the feed rather than merely exposing it.
- Deliver — put compliant, in-country private-feed and artifact delivery in front of (or in place of) the offshore cloud, so your teams and CI resolve from a resident feed without moving the store back across the border.
Making the public gallery merely reachable or mirrored is not the answer — your private packages, secrets, artifacts and contributor records are still offshore. Keeping the private feed and artifacts in-country is.
Where 21YunBox fits — a compliant overlay, not a migration
You keep running NuGet and your existing .NET toolchain. We add the piece an offshore registry cannot provide on its own: a lawful, in-country home for a self-hosted private feed so your packages, build artifacts and embedded secrets stay resident where the law requires, with compliant ICP-filed delivery for the developer access and any public-facing portal in front of it — placed around your existing setup, with no rebuild, no second codebase, and no migration off NuGet. As a partner to the ecosystem you already run, our China team maps your PIPL cross-border, consent and data-residency obligations against your entity and your pipeline, then stands up the in-country private feed and delivery a defensible China presence needs. We never use or suggest any form of circumvention.
Related reading:
- Cross-border data transfers under PIPL
- China’s Personal Information Protection Law
- China’s Cybersecurity Law and data localization
- How to get an ICP filing for China
