🌐 Documentation is currently available in English only. We're working on translations.

Home / Docs / Getting Started / Your First Package

Your First Package

Create and publish your first NuGet package to NugetHosting step by step.

⏱️ 5 min read

Prerequisites

Before you begin, make sure you have:

  • .NET SDK 6.0 or later installed
  • A NugetHosting account
  • An API token created (see API Tokens)

1. Create a Class Library Project

Let's create a simple class library that we'll publish as a NuGet package:

# Create a new class library
dotnet new classlib -n MyFirstPackage
cd MyFirstPackage

Edit the .csproj file to add package metadata:

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <PackageId>MyFirstPackage</PackageId>
  <Version>1.0.0</Version>
  <Authors>Your Name</Authors>
  <Description>My first NuGet package</Description>
</PropertyGroup>

2. Pack Your Package

Build and create the NuGet package:

dotnet pack -c Release

This creates a .nupkg file in bin/Release/

3. Push to NugetHosting

First, add NugetHosting as a package source (if you haven't already):

dotnet nuget add source https://nuget.nugethosting.com/v3/index.json \
  -n NugetHosting -u api -p YOUR_TOKEN

Now push your package:

dotnet nuget push bin/Release/MyFirstPackage.1.0.0.nupkg -s NugetHosting

4. Verify Your Upload

Check that your package was uploaded successfully:

  1. Go to your NugetHosting Dashboard
  2. Navigate to Packages
  3. You should see MyFirstPackage in the list

🎉 Congratulations! You've successfully published your first package to NugetHosting!

Was this page helpful?