[英]How can I push Nuget Package to GitHub Packages?
我正在嘗試將 simple.Net Core Class 庫推送到 GitHub 包。 我已經閱讀了https://docs.github.com/en/free-pro-team@latest/packages/using-github-packages-with-your-projects-ecosystem/configuring-do.net-中的所有文檔cli-for-use-with-github-packages
我已經創建了 .nupkg 文件,但無法將其推送到 GitHub。我該怎么做? 推送命令給出以下錯誤:
dotnet nuget push "bin/Release/Vegas.Util.AppLogger.1.0.0.nupkg" --source "github"
PUT https://nuget.pkg.github.com/kenannur/
warn : No destination repository detected. Ensure the source project has a 'RepositoryUrl' property defined. If you're using a nuspec file, ensure that it has a repository element with the required 'type' and 'url' attributes.
BadRequest https://nuget.pkg.github.com/kenannur/ 155 ms
error: Response status code does not indicate success: 400 (Bad Request).
這是我項目中的 nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="github" value="https://nuget.pkg.github.com/kenannur/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="kenannur" />
<add key="ClearTextPassword" value="*********************" />
</github>
</packageSourceCredentials>
</configuration>
這里是.csproj文件
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PackageId>Vegas.Util.AppLogger</PackageId>
<Authors>Kenan Nur</Authors>
<Owners>kenannur</Owners>
<PackageTags>log logger</PackageTags>
<Title>AppLogger</Title>
<Description>Basit console logger</Description>
<PackageVersion>1.0.0</PackageVersion>
<Version>1.0.0</Version>
<RepositoryUrl>https://github.com/kenannur/applogger</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.5-dev.8">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
對於那些仍在尋找解決方案的人。
<RepositoryUrl>here goes your repo url</RepositoryUrl>
例如:
<PropertyGroup>
...
<RepositoryUrl>https://github.com/johndoe/hello-world.git</RepositoryUrl>
</PropertyGroup>
do.net pack --configuration Release
您現在可以使用所需的 arguments 運行do.net nuget push
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.