【问题标题】:.net Core Pipeline in azure devopsazure devops 中的 .net 核心管道
【发布时间】:2021-11-19 17:30:23
【问题描述】:

我是使用 Azure DevOps 的新手。 我正在尝试创建一个管道以编译 Visual Studio 2022 解决方案。 为此,我必须从远程服务器 (https://api.nuget.org/v3/index.json) 以及本地目录(存储在我的存储库中的包)安装 NuGet 包。 这是我的 Yaml 文件

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1


- task: NuGetCommand@2
  inputs:
    command: 'restore'
    packagesToPush: ' $(Build.SourcesDirectory)/NuPackages/*.nupkg'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    allowPackageConflicts: true
    includeNuGetOrg: true

当我启动我的管道时,远程包已安装,但未安装本地包。

> Installed:
>     158 package(s) to D:\a\1\s\****.csproj
>     212 package(s) to D:\a\1\s\****.csproj
>     158 package(s) to D:\a\1\s\****.csproj
> ##[error]The nuget command failed with exit code(1) and error(NU1101: Unable to find package UnifiedAutomation.UaBase.BouncyCastle. No
> packages exist with this id in source(s): NuGetOrg NU1101:

我也尝试分两步执行此操作,但我遇到了同样的问题 如果有人有想法,那就太好了。

提前致谢

【问题讨论】:

    标签: .net visual-studio .net-core azure-devops yaml


    【解决方案1】:

    尝试添加此任务:

    - task: NuGetAuthenticate@0
    

    确保您的管道可以访问您的 nuget 存储库。 关注本官方documentation

    还要确保 nuget 存储库位于代码 (project/.nuget/nuget.config) 中的 nuget 源中:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <solution>
        <add key="disableSourceControlIntegration" value="true" />
      </solution>
      <packageSources>
        <add key="Nuget v2" value="https://www.nuget.org/api/v2" />
        <add key="Nuget v3" value="https://api.nuget.org/v3/index.json" />
        <add key="your nuget repos" value="https://nugetreposlink/nuget/v3/index.json" />
      </packageSources>
    </configuration>
    

    【讨论】:

      【解决方案2】:

      你必须有你的 nuget.config。 yml文件变成

      - task: NuGetToolInstaller@1
      - task: NuGetCommand@2
        inputs:
          command: 'restore'
          restoreSolution: '$(solution)'
          feedsToUse: 'config'
          nugetConfigPath: 'NuGet.Config'
      

      并在您的 yml 文件的同一位置添加一个 Nuget.config,其中包含您的所有值:

      <?xml version="1.0" encoding="utf-8"?>
      <configuration>
        <packageSources>
          <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
          <add key="DevExpress" value="https://nuget.devexpress.com/xxx/api" />
        </packageSources>
      </configuration>
      

      【讨论】:

        猜你喜欢
        • 2020-08-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-11-23
        • 2020-02-04
        • 1970-01-01
        相关资源
        最近更新 更多