Azure Artifacts enables developers to efficiently manage all their dependencies from a single feed. Feeds in Azure Artifacts serve as organizational repositories for storing, managing, and sharing your packages within your team, across organizations, or publicly on the internet. Azure Artifacts feeds support a wide range of package types, including NuGet, npm, Python, Maven, Cargo, and Universal Packages.
This article walks you through the process of publishing your first package to an Azure Artifacts feed. You also have the option to use GitHub Copilot to streamline this process and explore the capabilities of the GitHub Copilot Chat in Visual Studio Code.
Sign in to your Azure DevOps organization, and then navigate to your project.
Select Artifacts, and then select Create Feed.
Provide a descriptive Name for your feed and set its Visibility (who can view packages in your feed). Define the Scope of your feed, and if you want to include packages from public sources, check the Upstream sources checkbox.
Select Create when you're done.
Sign in to your Azure DevOps server, and then navigate to your project.
Select Artifacts, and then select Create Feed.
Provide a descriptive Name for your feed and set its Visibility (who can view packages in your feed). Define the Scope of your feed, and if you want to include packages from public sources, check the Upstream sources checkbox.
Run the following command to package your project and generate a .nupkg artifact. your NuGet package is generated in the bin\release directory.
.NET CLI
dotnetpack
Before publishing a package to the feed you created earlier, you must first pack your project and prepare it for publishing.
The following example walks you through using GitHub Copilot to create a sample .NET Core class library and generate a NuGet package from the command line. You can also use GitHub Copilot to generate other types of projects, such as npm or Python projects.
Open Visual Studio Code and select the chat icon from the left navigation panel to open the GitHub Copilot Chat.
In the prompt box. ask GitHub copilot: "How do I create a .NET Core project and package it as a NuGet package?". GitHub Copilot's response might be something similar to the following:
Follow the provided steps to generate your project, define your package ID and version, and pack your project.
You can also ask GitHub Copilot to explain your project structure using the @workspace command, which lets you interact with the files and folders in your current workspace.
@workspace explain my app structure
Another useful method to understand new source code is to ask GitHub Copilot how specific files are related within the project. For example, you can ask how the csproj file is related to the Class1.cs file:
#file:artifacts-github-copilot.csproj #file:Class1.cs how are these files related
Connect to a feed
Select Artifacts and then select your feed from the dropdown menu.
Select Connect to feed, and then select dotnet from the NuGet section.
Follow the instructions in the Project setup to set up your nuget.config file. The structure of your file should look similar to this:
Sign in to your Azure DevOps collection, and then navigate to your project.
Select Artifacts, and then select your feed from the dropdown menu.
Select Connect to Feed, and then select dotnet from the left navigation pane.
Follow the instructions in the Project setup section to configure your nuget.config file and connect to your feed.
რჩევა
You can ask GitHub Copilot, "how to add a new package source to an existing nuget.config file". Copilot will guide you through using the nuget sources Add command to add your new feed source URL to your nuget.config file.
Publish packages
Run the following command from your project directory to publish your package. The ApiKey is required, but you can use any string value when publishing to an Azure Artifacts feed.
.NET CLI
dotnetnuget push --source<FEED_NAME> --api-key az <PACKAGE_PATH>
შემოუერთდით Meetup სერიას, რათა შექმნათ მასშტაბური AI გადაწყვეტილებები რეალურ სამყაროში გამოყენების შემთხვევებზე დაყრდნობით თანამემამულე დეველოპერებთან და ექსპერტებთან.
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.
Create, host, and share NuGet, npm, Maven, Python, Cargo, and Universal Packages with Azure Artifacts for seamless package management and collaboration across projects and organizations.