gitlab - 尝试将 NuGet 包发布到 gitlab.com 时出现错误“无法加载源的服务索引”
问题描述
我在gitlab.com上有一个私人 C# 项目,想在那里创建一个 NuGet 包。
我按照说明在解决方案级别创建了以下Nuget.config
文件。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="gitlab" value="https://gitlab.com/api/v4/project/{my_project_numeric_id_here}/packages/nuget/index.json" />
</packageSources>
<packageSourceCredentials>
<gitlab>
<add key="Username" value="{my_username_in_gitlab}" />
<add key="ClearTextPassword" value="{my_personal_token_with_api_access_here}" />
</gitlab>
</packageSourceCredentials>
</configuration>
然后我使用 Visual Studio 包管理器控制台并运行以下命令:
dotnet nuget push "C:\{path_to_the_package_here}\MyProject.1.0.0.nupkg" --source gitlab
并出现以下错误:
error: Unable to load the service index for source https://gitlab.com/api/v4/project/{my_project_numeric_id_here}/packages/nuget/index.json.
error: Response status code does not indicate success: 404 (Not Found).
MyProject.1.0.0.nupkg
——存在。
Nuget.config
— 由命令看到(反映文件中的更改)。
Personal Token
— 我用不同的权限玩,至少授予 api 权限,其他所有权限也是如此。
我的操作有什么问题以及如何从 GitLab.com 上的 C# 项目创建 NuGet 包?
解决方案
推荐阅读
- c# - Specflow - 我们可以在 Specflow 示例表中传递参数吗
- php - 更新二维数组 PHP
- ios - 如果 TableView 中有 HeaderView,Swift prefersLargeTitles 不起作用
- mql5 - 如何解决设计错误的 OrderSendAsync() -函数 [mql5]
- android - 在 tns build android --release 应用程序不进行 REST 调用之后
- java - 从 Java 中调用 `scala.Function1[_root_.scala.Predef.String, scala.Any]`
- python - 如何在 django 中制作一个类似于谷歌表单的表单?用户可以在哪里根据需要添加或删除字段?用户最多可以添加10-20个字段?
- maven - GitHub Packages 404 for maven-metadata.xml / 是否支持动态版本解析?
- r - 如何将高斯曲线拟合到这些数据?
- android - 泄漏金丝雀检测 MediaBrowserServiceCompat 示例应用程序中的内存泄漏