* Update README * [Universe] Dark mode (#16545) * Dark mode updates (#16696) * [Universe] Corporate sponsors (#16457) * Dependency review beta (#16563) * Add placeholder topic file * Revert change I didn't make I'm not sure where this change came from or why it's showing up in my PR here but I didn't make this change and it's not part of Dependency Review so I'm reverting it. * Un-revert previous change OK I see what happened there. I was comparing the PR to main rather than the Universe megabranch, hence it showed a change I didn't make. This commit undoes the change I do not want to revert on the megabranch. * Update image to add the Checks tab * Finish updating topic to mention DR * Fix check errors * Fix another versioning error * Add a sentence about supported ecosystems * Add review changes * Remove Further reading topics in same category As suggested by James, I've removed the links to topics that are in the same `/collaborating-with-issues-and-pull-requests/` category as this topic. * Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> * Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> * Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> * Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md * Updates in the light of Maya's review * Remove use of "exploit" in description * Change 'dependency review summary' to 'dependency review' See PR review comment from Maya. * Mention that the age of the dependency is given * Update screenshots to latest GUI * Add details of dependency ordering within a DR * Update content/github/collaborating-with-issues-and-pull-requests/reviewing-dependency-changes-in-a-pull-request.md Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> * Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> * Update content/github/visualizing-repository-data-with-graphs/about-the-dependency-graph.md Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> * [Universe 2020] New audit log REST API endpoint (#16699) * Minimal updates for preview * ✨ API previews ✨ * Update beta note * ✨ Update API previews ✨ * ✨ Update previews ✨ * Add draft section for git events * Clean API previews * More fixes + API previews * Address review comments + update API previews * Mention cursor-based pagination * Update content/rest/overview/resources-in-the-rest-api.md Co-authored-by: Jeff Saracco <jeffsaracco@github.com> * Temporarily revert API previews * Small tweaks from review comments + API previews * revert json schemas * Updating OpenAPI descriptions (#16776) * Updating OpenAPI descriptions * Add decorated OpenAPI schema files Co-authored-by: Jeff Saracco <jeffsaracco@github.com> Co-authored-by: skedwards88 <skedwards88@github.com> Co-authored-by: github-openapi-bot <69533958+github-openapi-bot@users.noreply.github.com> * [Universe 2020] GitHub Actions: Workflow visualization (#16629) * initial empty commit * replace image used only for dotcom * add new image and version usage * add new image and version usage * add new image and version usage * add new image and version usage, delete unneeded image * add new image and version usage, fix incorrect image * add new image and version usage * add new image and version usage * add new image and version usage * add new image and version usage * update screenshot update * add new image and version usage * add new image and version usage * update text * update images and fix list numbering * add step with graph * Add missing versioning * add overview of visualization * fix title to match filename * add beta note * update wording * Restructuring packages (#16731) * restructuring packages * moving more content * moving more content * fixing the toc for guides * removing CR from the landing page * adjusting qs * updating npm * enhancing guides * Update updating-github-insights.md * fixing link problems * fixing link problems * redirecting the redirects * another change * fixing the guides landing page * add packages quickstart * moving CR content * adding some descriptive text * add packages landing page * adding guide content back * update popular articles based on data * fix caps on product name * try removing product from front matter * Update content/packages/quickstart.md Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> * Update content/packages/quickstart.md Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> * add node package instructions to quickstart * fixing links and adding redirect * fixing redirects * renaming to container guides * renaming to container guides and fixing reusables * adding context and about section to CR * removign landign page extra titles and descriptions * reverting the packages * updating link * Apply suggestions from code review Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> * updating * update test to reflect redesigned product landing page * Add private vs public clarification * Fix borked test * filter out standalone category files from test Co-authored-by: Cynthia Rich <crichID@github.com> Co-authored-by: Cynthia Rich <crichID@users.noreply.github.com> Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> Co-authored-by: Sarah Schneider <sarahs@github.com> Co-authored-by: Jason Etcovitch <jasonetco@github.com> * Add discussions video See https://github.com/github/docs-internal/pull/16759 * Remove typos * update article name in test Co-authored-by: Laura Coursen <lecoursen@github.com> Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com> Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com> Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com> Co-authored-by: Jeff Saracco <jeffsaracco@github.com> Co-authored-by: skedwards88 <skedwards88@github.com> Co-authored-by: github-openapi-bot <69533958+github-openapi-bot@users.noreply.github.com> Co-authored-by: Meg Bird <megbird@github.com> Co-authored-by: Leona B. Campbell <3880403+runleonarun@users.noreply.github.com> Co-authored-by: Cynthia Rich <crichID@github.com> Co-authored-by: Cynthia Rich <crichID@users.noreply.github.com> Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> Co-authored-by: Sarah Schneider <sarahs@github.com> Co-authored-by: Jason Etcovitch <jasonetco@github.com>
8.5 KiB
title, intro, product, redirect_from, versions
| title | intro | product | redirect_from | versions | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Configuring `dotnet` CLI for use with GitHub Packages | You can configure the `dotnet` command-line interface (CLI) to publish NuGet packages to {% data variables.product.prodname_registry %} and to use packages stored on {% data variables.product.prodname_registry %} as dependencies in a .NET project. | {% data reusables.gated-features.packages %} |
|
|
{% data reusables.package_registry.packages-ghes-release-stage %}
{% data reusables.package_registry.admins-can-configure-package-types %}
Authenticating to {% data variables.product.prodname_registry %}
{% data reusables.package_registry.authenticate-packages %}
Authenticating with a personal access token
{% data reusables.package_registry.required-scopes %}
To authenticate to {% data variables.product.prodname_registry %} with the dotnet command-line interface (CLI), create a nuget.config file in your project directory specifying {% data variables.product.prodname_registry %} as a source under packageSources for the dotnet CLI client.
You must replace:
USERNAMEwith the name of your user account on {% data variables.product.prodname_dotcom %}.TOKENwith your personal access token.OWNERwith the name of the user or organization account that owns the repository containing your project.{% if enterpriseServerVersions contains currentVersion %}HOSTNAMEwith the host name for your {% data variables.product.prodname_ghe_server %} instance.
If your instance has subdomain isolation enabled: {% endif %}
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="github" value="https://{% if currentVersion == "free-pro-team@latest" %}nuget.pkg.github.com{% else %}nuget.HOSTNAME{% endif %}/OWNER/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="USERNAME" />
<add key="ClearTextPassword" value="TOKEN" />
</github>
</packageSourceCredentials>
</configuration>
{% if enterpriseServerVersions contains currentVersion %} If your instance has subdomain isolation disabled:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="github" value="https://HOSTNAME/_registry/nuget/OWNER/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="USERNAME" />
<add key="ClearTextPassword" value="TOKEN" />
</github>
</packageSourceCredentials>
</configuration>
{% endif %}
Authenticating with the GITHUB_TOKEN
{% data reusables.package_registry.package-registry-with-github-tokens %}
Publishing a package
You can publish a package to {% data variables.product.prodname_registry %} by authenticating with a nuget.config file. When publishing, you need to use the same value for OWNER in your csproj file that you use in your nuget.config authentication file. Specify or increment the version number in your .csproj file, then use the dotnet pack command to create a .nuspec file for that version. For more information on creating your package, see "Create and publish a package" in the Microsoft documentation.
{% data reusables.package_registry.viewing-packages %}
{% data reusables.package_registry.authenticate-step %} 2. Create a new project.
dotnet new console --name OctocatApp
- Add your project's specific information to your project's file, which ends in .csproj. You must replace:
OWNERwith the name of the user or organization account that owns the repository containing your project.REPOSITORYwith the name of the repository containing the package you want to publish.1.0.0with the version number of the package.{% if enterpriseServerVersions contains currentVersion %}HOSTNAMEwith the host name for your {% data variables.product.prodname_ghe_server %} instance.{% endif %}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PackageId>OctocatApp</PackageId>
<Version>1.0.0</Version>
<Authors>Octocat</Authors>
<Company>GitHub</Company>
<PackageDescription>This package adds an Octocat!</PackageDescription>
<RepositoryUrl>https://{% if currentVersion == "free-pro-team@latest" %}github.com{% else %}HOSTNAME{% endif %}/OWNER/REPOSITORY</RepositoryUrl>
</PropertyGroup>
</Project>
- Package the project.
dotnet pack --configuration Release
- Publish the package using the
keyyou specified in the nuget.config file.
dotnet nuget push "bin/Release/OctocatApp.1.0.0.nupkg" --source "github"
Publishing multiple packages to the same repository
To publish multiple packages to the same repository, you can include the same {% data variables.product.prodname_dotcom %} repository URL in the RepositoryURL fields in all .csproj project files. {% data variables.product.prodname_dotcom %} matches the repository based on that field.
For example, the OctodogApp and OctocatApp projects will publish to the same repository:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PackageId>OctodogApp</PackageId>
<Version>1.0.0</Version>
<Authors>Octodog</Authors>
<Company>GitHub</Company>
<PackageDescription>This package adds an Octodog!</PackageDescription>
<RepositoryUrl>https://{% if currentVersion == "free-pro-team@latest" %}github.com{% else %}HOSTNAME{% endif %}/octo-org/octo-cats-and-dogs</RepositoryUrl>
</PropertyGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PackageId>OctocatApp</PackageId>
<Version>1.0.0</Version>
<Authors>Octocat</Authors>
<Company>GitHub</Company>
<PackageDescription>This package adds an Octocat!</PackageDescription>
<RepositoryUrl>https://{% if currentVersion == "free-pro-team@latest" %}github.com{% else %}HOSTNAME{% endif %}/octo-org/octo-cats-and-dogs</RepositoryUrl>
</PropertyGroup>
</Project>
Installing a package
Using packages from {% data variables.product.prodname_dotcom %} in your project is similar to using packages from nuget.org. Add your package dependencies to your .csproj file, specifying the package name and version. For more information on using a .csproj file in your project, see "Working with NuGet packages" in the Microsoft documentation.
{% data reusables.package_registry.authenticate-step %}
- To use a package, add
ItemGroupand configure thePackageReferencefield in the .csproj project file, replacing theOctokittenApppackage with your package dependency and1.0.0with the version you want to use:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PackageId>OctocatApp</PackageId>
<Version>1.0.0</Version>
<Authors>Octocat</Authors>
<Company>GitHub</Company>
<PackageDescription>This package adds an Octocat!</PackageDescription>
<RepositoryUrl>https://{% if currentVersion == "free-pro-team@latest" %}github.com{% else %}HOSTNAME{% endif %}/OWNER/REPOSITORY</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OctokittenApp" Version="12.0.2" />
</ItemGroup>
</Project>
- Install the packages with the
restorecommand.
dotnet restore