使用 Azure DevOps 任务,我正在尝试构建使用外部包源的 .net 核心应用程序,如下所述
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Public" value="https://microsofthealthoss.pkgs.visualstudio.com/FhirServer/_packaging/Public/nuget/v3/index.json" />
<add key="local" value="./lib" />
</packageSources>
</configuration>
我定义了以下任务
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '**\*.sln'
feedsToUse: config
nugetConfigPath: 'NuGet.config'
- task: DotNetCoreCLI@2
displayName: "Restore dotnet packages"
inputs:
command: restore
projects: "**/*.csproj"
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
- task: DotNetCoreCLI@2
displayName: "Build with Development configuration"
inputs:
projects: "**/ProductX.HIS.WebApi/**/*.csproj"
arguments: "--configuration Development"
抛出以下错误
Build FAILED.
"/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj" (Restore target) (1) ->
(Restore target) ->
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
/home/vsts/work/1/s/lib/FHIR-Converter-main/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj : error NU1301: The local source '/home/vsts/work/1/Nuget/lib' doesn't exist.
0 Warning(s)
8 Error(s)
我在 Azure DevOps Repo 中有 lib 文件夹,如下所示
我该如何解决这个问题?
我已经使用以下任务来解决这个问题
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/lib'
Contents: '**'
TargetFolder: '$(Agent.BuildDirectory)/Nuget/lib'
OverWrite: true
- task: DotNetCoreCLI@2
displayName: "Restore dotnet packages"
inputs:
command: restore
projects: "**/*.csproj"
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
- task: DotNetCoreCLI@2
displayName: "Build with Development configuration"
inputs:
projects: "**/ProjectX.WebApi/**/*.csproj"
arguments: "--configuration Development"