简体   繁体   English

.net 核心管道 azure devops

[英].net Core Pipeline in azure devops

I am new to working with Azure DevOps.我是 Azure DevOps 的新手。 I am trying to create a pipeline in order to compile a Visual Studio 2022 solution.我正在尝试创建管道以编译 Visual Studio 2022 解决方案。 In order to do this, I have to install NuGet packages from a remote server ( https://api.nuget.org/v3/index.json ) and also from a local directory (packages stored on my repository).为此,我必须从远程服务器 ( https://api.nuget.org/v3/index.json ) 以及本地目录(存储在我的存储库中的包)安装 NuGet 包。 Here my Yaml file这是我的 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

When I launch my pipline, the remote package are installed but not the local ones.当我启动我的管道时,安装了远程 package 而不是本地的。

> 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:

I've also tried to do this in two steps, but I had the same problem If anybody have an idea, it will be great.我也尝试过分两步完成此操作,但我遇到了同样的问题如果有人有想法,那就太好了。

Thanks in advance提前致谢

try adding this task:尝试添加此任务:

- task: NuGetAuthenticate@0

to make sure you have the pipelines has access to your nuget repos.确保您可以通过管道访问您的 nuget 存储库。 Following this official documentation按照这个官方文档

Also make sure the nuget repos are within the sources of nugets in your code (project/.nuget/nuget.config):还要确保 nuget 存储库在代码中的 nugets 源内 (project/.nuget/nuget.config):

<?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>

You must have your nuget.config.您必须拥有 nuget.config。 Yml file become yml文件变成

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

and in the same location of your yml file add a Nuget.config with all your value:并在您的 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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 .net 核心单元测试项目未能在 Azure Devops 管道中构建 - .net core unit test project failing to build in Azure Devops pipeline 构建 .NET 5.0 项目 Azure DevOps 流水线 - Building .NET 5.0 project Azure DevOps pipeline 如何在 Azure DevOps 管道中为 .net 构建设置 output 路径 - How to set output path for .net build in Azure DevOps Pipeline 无法在 Azure DevOps 发布管道中提取 .NET 单文件应用程序 - Unable to extract .NET Single File Application in Azure DevOps release pipeline 在Azure Devops中的Linux映像中构建.NET Core项目时缺少MissingMethodException - MissingMethodException while building .NET Core Project in a linux image in Azure Devops Azure 用于运行进程的 DevOps 管道 - Azure DevOps pipeline for running processes 无法在 Azure Devops 上使用 DotNetCoreCLI 任务恢复.Net Core 解决方案 - Can't restore .Net Core solution with DotNetCoreCLI task on Azure Devops 如何使用“.Net FrameWork 4.7”项目在 Azure DevOps Pipeline 上创建 Coverlet 覆盖率报告? - How do I create a coverlet coverage report on Azure DevOps Pipeline with a ".Net FrameWork 4.7" project? Azure Devops CI 管道未显示在代理任务下构建项目的 Net 选项 - Azure Devops CI pipeline not showing .Net option to build a project under Agent tasks 在 Azure DevOps 管道中使用来自 .NET 框架的实体框架更新数据库 - Update database using Entity Framework from .NET Framework in Azure DevOps pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM