azure devops 中的 .net 核心管道
.net Core Pipeline in azure devops
我刚开始使用 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\s\****.csproj
> 212 package(s) to D:\a\s\****.csproj
> 158 package(s) to D:\a\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:
我也试过分两步来做,但我遇到了同样的问题
如果有人有想法,那就太好了。
提前致谢
尝试添加此任务:
- task: NuGetAuthenticate@0
确保您的管道可以访问您的 nuget 存储库。
关注这位官方documentation
还要确保 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>
你必须有你的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>
我刚开始使用 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\s\****.csproj
> 212 package(s) to D:\a\s\****.csproj
> 158 package(s) to D:\a\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:
我也试过分两步来做,但我遇到了同样的问题 如果有人有想法,那就太好了。
提前致谢
尝试添加此任务:
- task: NuGetAuthenticate@0
确保您的管道可以访问您的 nuget 存储库。 关注这位官方documentation
还要确保 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>
你必须有你的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>