azure devops:dotnet发布找不到该软件包,因为它在错误的源搜索中搜索 我们有一条Azure Classic Pipeline(不是YAML),该管道构建了一个具有净核心和传统净项目的解决方案。它有多个步骤,看起来像这样: 一些

问题描述 投票:0回答:1
项目中的某些需要在我们的自定义Nuget feed上托管的组件,并且我们使用的是nuget.config,该组件将传递给dotnet Restore任务(以及Nuget Restore Task)。看起来像这样:

<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://www.nuget.org/api/v2/" /> <add key="Pagesp" value="https://our_custom_feed_repository" /> </packageSources> </configuration> Azure Devops pipeline 不确定为什么,但是管道停止在dotnet发布步骤上工作。此步骤的YAML看起来像这样:

#Your build pipeline references an undefined variable named ‘BuildConfiguration’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972 steps: - task: DotNetCoreCLI@2 displayName: 'dotnet publish ' inputs: command: publish publishWebProjects: false projects: | ./project1.csproj ./project2.csproj arguments: '-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) --self-contained -r win-x64' verbosityRestore: Detailed verbosityPack: Detailed

日志显示Dotnet Publish试图从我们的Nuget Feed到Microsoft.netcore.app.runtime.win-x64,而不是从官方中获取它:

025-02-05T16:56:40.0184221Z Retrying 'FindPackagesByIdAsyncCore' for source 'https://our_custom_feed_repository/nuget/FindPackagesById()?id='Microsoft.NETCore.App.Runtime.win-x64'&semVerLevel=2.0.0'. 2025-02-05T16:56:40.0189364Z Response status code does not indicate success: 401 (Unauthorized).

任何有关发生了什么事的线索?

thanks.

	

在您的描述上,您的

dotnet restore

似乎努力从您的预期来源检索包装,但是

dotnet publish
azure-devops nuget-package-restore dotnet-publish
1个回答
0
投票
为此,您可以尝试在文档中建议的那样,将

--no-restore

标志添加到
arguments
属性的thrap traper-为什么我的构建,发布或测试步骤未能还原软件包?

大多数commands,包括

dotnet publish
dotnet
build
包括一个Implicit步。即使您在较早的步骤中运行了成功的far,这也将不受身份验证的提要失败,因为较早的步骤将清理使用的凭据。

要解决此问题,请在
publish

文本框中添加

test
标志。
    

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.