[英].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.