How to sell a .NET library through a private NuGet feed
If you sell a .NET library, your buyers need a way to download it that only paying people can use. You can run this by hand with an existing feed host. This guide shows what the job involves and the settings that matter, using Azure Artifacts as the worked example.
What a paid feed has to do
Before you pick a host, write down what the feed must handle. For a vendor selling a library, the list is short.
- A buyer pays and receives an address for the feed and a credential.
- The buyer's build can restore your package using that credential.
- When the subscription ends, the credential stops working.
- You can see who has access and who downloaded what.
- Each release has its own version number that never changes after publishing.
Steps 1 and 2: Create a private feed and set roles
Azure Artifacts feeds can be private, so you share packages with specific users only. In the Azure DevOps portal you go to Artifacts, pick or create your feed, and use the gear icon to reach Feed settings.
Keep one feed per product line. Your own build agent needs the Feed Publisher (Contributor) role to publish; buyers only need to read.
Azure Artifacts feeds have roles. According to the Microsoft documentation, a Feed Reader can list, view and download packages, while a Feed Publisher can also publish, promote, deprecate and unlist them. Give buyers the reader role only.
Feed views let you share selected package versions without exposing everything in the feed. A common pattern is to keep new builds in the local view, share previews through a prerelease view and share approved builds through a release view. One warning from the documentation: people who can open a view can download from it even without access to the feed itself, so restrict both when you need a hard boundary.
Azure Artifacts includes 2 GiB of storage per organization at no charge, and Microsoft lists a price per GiB beyond that, so a small library fits comfortably before you pay anything for hosting. Other hosts price by plan, so compare storage and download limits before you commit.
Step 3: Give the buyer a way to sign in
Buyers add your feed address to the nuget.config file of their project. When the feed answers with an authorization error, NuGet looks for credentials in a fixed order: an environment variable named for the source, credentials in nuget.config, then a credential provider if your package source provides one.
The Microsoft documentation notes that it is very common for package sources to forbid your normal password and to ask for a personal access token instead, so tell buyers exactly which kind of credential your feed expects. Send the setup steps with the purchase email, not after the first support request.
Microsoft's documentation also describes how a build server signs in. On a developer machine, an interactive sign-in the first time you restore is the recommended approach. For containers and automated builds, credentials are passed through environment variables, and in Azure Pipelines a dedicated authentication task handles it. Ask a buyer's build engineer which of these they will use, and test your setup instructions on a clean machine before you send them out.
- The feed address, copied exactly.
- The kind of credential your host expects and how long it lasts.
- A sample nuget.config entry for your feed.
- Who to contact if a restore fails with an authorization error.
Step 4: Track who has paid
By hand, this is a table with one row per buyer: name, email, plan, renewal date, the account you added to the feed, and the date you last checked. Review it on a fixed day each month and use this checklist.
Trials need the same discipline. Note the end date for each trial in your table the day you grant access, and remove the account on that date. If you forget, a trial becomes a free license, and it is hard to take back.
- Compare the table with your payment records.
- Remove feed access for any buyer whose subscription ended.
- Add feed access for new buyers, with the reader role only.
- Note any trial that is about to expire.
- Write down who restored the package recently, if your host shows it.
Step 5: Keep releases clean
Azure Artifacts treats a published version number as permanent. You cannot overwrite it or reuse the number, even after deleting the package, so fix a bad release by publishing a new version. Retention policies can remove old versions automatically; packages promoted to a view are exempt from them, so promote the versions your buyers rely on.
Finally, plan for an outage. If your feed is unreachable, your buyers' builds fail, and they will blame you. Keep a status page or a short notice ready, keep your own copy of every released package, and decide in advance how quickly you will answer a buyer who cannot restore.
Where Paid NuGet feed fits
The Paid NuGet feed is coming soon. It is planned to do the manual parts above for you: the buyer's license key becomes the feed login, access ends when the subscription ends, and you see who downloaded what, all managed inside LicensePier. We have not set a date; join the list and we email you at launch.
Sources
- Microsoft Learn: Manage permissions in Azure Artifacts
- Microsoft Learn: Consuming packages from authenticated feeds
- Microsoft Learn: Azure Artifacts best practices
- Microsoft Learn: Publish and download NuGet packages with Azure Artifacts
Coming soon: Paid NuGet feed for component vendors
A private NuGet feed where your buyer's license key is the login. A hosted private download server for .NET libraries, built as an add-on for LicensePier. You sell a library, the buyer pays through Stripe and receives a feed address and a key, and the key works only while the subscription is active. It is for small companies that sell .NET components.
Get Paid NuGet feed for component vendors first
Join the list and get 25% off your first purchase when it goes on sale. We email you a discount code on launch day. One code per person, for new customers.
One email when it launches (plus the discount code). No other mail, and you can say stop at any time. See our privacy policy.