Skip to main content

Working with NuGet

Publish NuGet Package

  1. 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.json    
    ParamExplanation
    <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
  2. Push desired packages to the source:

    $ dotnet nuget push -s onedev /path/to/<PackageId>.<PackageVersion>.nupkg
  3. 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 permission

    dotnet 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.json
    ParamExplanation
    <project path>same as above

Consume Published NuGet Package

The package detail page contains instructions on how to consume published image.

Query Published NuGet Package

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