Publish .NET Library to Github packages with a name and the version

663 Views Asked by At

I have created a .NET library C# project and published as a nuget package to my Github packages. The published package doesn't show the correct naming and version in Assets.

I created a NuGet.config in the project folder. Then followed

dotnet pack --configuration Release

dotnet nuget push "bin/Release/OctocatApp.1.0.0.nupkg" --source "github"

Expectation: OctocatApp.1.0.1.nupkg

Actual : package.nupkg

I followed Github Reference. Can anyone help me to identify what is going wrong with the step? or is there anyway to set a display text in Assets?

GIT Assets Example

Edit: Adding .csproject configuration & nuget.config

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <PackageId>OctocatApp</PackageId>
    <Version>1.0.0</Version>
    <Authors>Octocat</Authors>
    <Company>GitHub</Company>
    <PackageDescription>This package adds an Octocat!</PackageDescription>
    <RepositoryUrl>https://github.com/*****/PackageDemo</RepositoryUrl>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  </PropertyGroup>
</Project>

nuget.config

<configuration>
    <packageSources>
        <clear />
        <add key="github" value="https://nuget.pkg.github.com/****/index.json" />
    </packageSources>
    <packageSourceCredentials>
        <github>
            <add key="Username" value="My Name" />
            <add key="ClearTextPassword" value="***************" />
        </github>
    </packageSourceCredentials>
</configuration>
1

There are 1 best solutions below

0
On

Yes it's a weird problem.

See on github.community for more mentions of the same problem, and here for a solution.

Essentially use the GPR .NET Core global tool for pushing to the GitHub package registry.