Working with NuGet
Publish NuGet Package
-
Add a package source:
$ dotnet nuget add source --name onedev --username <onedev_account_name> --password <onedev_account_password> --store-password-in-clear-text https://onedev.example.com/<project path>/~nuget/index.jsonParam Explanation <onedev_account_name> name of OneDev account with package write permission over the project <onedev_account_password> password or access token of OneDev account <project path> path of a project with package management enabled -
Build your package and push it to the source:
dotnet pack --configuration Release --output ./packages$ dotnet nuget push -s onedev /path/to/<PackageId>.<PackageVersion>.nupkg -
For CI/CD job, run below to add package source via command step
# Use job token to tell OneDev the build pushing the package# Job secret 'access-token' should be defined in project build setting as an access token with package write permissiondotnet nuget add source --name onedev --username "@job_token@" --password "@secret:access-token@" --store-password-in-clear-text https://onedev.example.com/<project path>/~nuget/index.jsondotnet pack --configuration Release --output ./packagesdotnet nuget push -s onedev ./packages/<PackageId>.<PackageVersion>.nupkgParam Explanation <project path> same as above
Consume Published NuGet Package
Configure the same source in a separate consumer project with package read permission, then add the dependency:
dotnet add package <PackageId> --version <PackageVersion> --source https://onedev.example.com/<project-path>/~nuget/index.json
dotnet restore
The package detail page provides commands for the selected version.
The Server URL in Administration > System Settings must be reachable by the client or build container, because the NuGet service index advertises additional registry endpoints. Keep the credential-bearing NuGet configuration out of source control. Use HTTPS for deployed registries; newer SDKs restrict HTTP sources.

Query Published NuGet Package
When query NuGet package from package list page, Name represents id of NuGet package