微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Devops MSBuild 错误无法找到 NuGet 包

如何解决Devops MSBuild 错误无法找到 NuGet 包

我创建了一个 DevOps 管道来构建 asp.net 网站。我可以在我的计算机上构建站点,但是当我使用 Pipelines 时,它会出错:

Error CS0246: The type or namespace name 'Azure' Could not be found (are you missing a using directive or an assembly reference?

我从 NuGet 安装了三个 Azure 包,根据 NuGet 还原任务,它正在安装它们(和其他包)而没有错误

SYstemVSSCONNECTION exists true
SYstemVSSCONNECTION exists true
[command]C:\Windows\system32\chcp.com 65001
Active code page: 65001
Detected NuGet version 4.4.1.4656 / 4.4.1
SYstemVSSCONNECTION exists true
[command]C:\hostedtoolcache\windows\NuGet\4.4.1\x64\nuget.exe sources Add -NonInteractive -Name NuGetorg -Source https://api.nuget.org/v3/index.json -ConfigFile D:\a\1\Nuget\tempNuGet_108.config
Package Source with Name: NuGetorg added successfully.
[command]C:\hostedtoolcache\windows\NuGet\4.4.1\x64\nuget.exe restore D:\a\1\s\EncryptionDecryptionLib\EncryptionDecryptionLib.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\1\Nuget\tempNuGet_108.config
NuGet Version: 4.4.1.4656
MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
MSBuild P2P timeout [ms]: 120000
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\5rlwkrkr.ltc.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\lluddamt.xwo.nugetrestore.targets" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet\4.4.1\x64\nuget.exe" /p:RestoreSolutionDirectory="D:\a\1\s\EncryptionDecryptionLib" /p:RestoreConfigFile="D:\a\1\Nuget\tempNuGet_108.config" /p:SolutionDir="D:\a\1\s\EncryptionDecryptionLib"

nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
[command]C:\hostedtoolcache\windows\NuGet\4.4.1\x64\nuget.exe restore D:\a\1\s\LabCode.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\1\Nuget\tempNuGet_108.config
NuGet Version: 4.4.1.4656
MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
WARNING: Project file D:\a\1\s\LabCode\ cannot be found.
nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
[command]C:\hostedtoolcache\windows\NuGet\4.4.1\x64\nuget.exe restore D:\a\1\s\LabCode\LabCode.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\1\Nuget\tempNuGet_108.config
NuGet Version: 4.4.1.4656
MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
MSBuild P2P timeout [ms]: 120000
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\pljrnr0g.jqu.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\hlbc31tk.hzh.nugetrestore.targets" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet\4.4.1\x64\nuget.exe" /p:RestoreSolutionDirectory="D:\a\1\s\LabCode" /p:RestoreConfigFile="D:\a\1\Nuget\tempNuGet_108.config" /p:SolutionDir="D:\a\1\s\LabCode"

Restoring NuGet package Azure.Core.1.15.0.
Restoring NuGet package Azure.Identity.1.5.0-beta.1.
Restoring NuGet package Azure.Security.keyvault.Keys.4.2.0-beta.6.
Restoring NuGet package Azure.Security.keyvault.Secrets.4.2.0-beta.5.
Restoring NuGet package EPPlus.5.6.3.
Restoring NuGet package Microsoft.Bcl.AsyncInterfaces.1.0.0.
Restoring NuGet package Microsoft.Identity.Client.4.30.1.
Restoring NuGet package Microsoft.Identity.Client.Extensions.Msal.2.18.4.
Restoring NuGet package Microsoft.IO.RecyclableMemoryStream.1.4.1.
Restoring NuGet package Microsoft.NETCore.Platforms.1.1.0.
Restoring NuGet package Microsoft.ReportViewer.Common.10.0.40219.1.
Restoring NuGet package Microsoft.ReportViewer.WebForms.10.0.40219.1.
Restoring NuGet package NETStandard.Library.2.0.0.
Restoring NuGet package System.Buffers.4.5.1.
Restoring NuGet package System.Diagnostics.DiagnosticSource.4.6.0.
Restoring NuGet package system.memory.4.5.4.
  GET https://api.nuget.org/v3-flatcontainer/azure.identity/1.5.0-beta.1/azure.identity.1.5.0-beta.1.nupkg
  GET https://api.nuget.org/v3-flatcontainer/azure.security.keyvault.secrets/4.2.0-beta.5/azure.security.keyvault.secrets.4.2.0-beta.5.nupkg
  GET https://api.nuget.org/v3-flatcontainer/epplus/5.6.3/epplus.5.6.3.nupkg
  GET https://api.nuget.org/v3-flatcontainer/azure.core/1.15.0/azure.core.1.15.0.nupkg
  GET https://api.nuget.org/v3-flatcontainer/microsoft.bcl.asyncinterfaces/1.0.0/microsoft.bcl.asyncinterfaces.1.0.0.nupkg
  GET https://api.nuget.org/v3-flatcontainer/microsoft.identity.client/4.30.1/microsoft.identity.client.4.30.1.nupkg
  GET https://api.nuget.org/v3-flatcontainer/microsoft.identity.client.extensions.msal/2.18.4/microsoft.identity.client.extensions.msal.2.18.4.nupkg
  GET https://api.nuget.org/v3-flatcontainer/microsoft.io.recyclablememorystream/1.4.1/microsoft.io.recyclablememorystream.1.4.1.nupkg
  GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/1.1.0/microsoft.netcore.platforms.1.1.0.nupkg
  GET https://api.nuget.org/v3-flatcontainer/microsoft.reportviewer.common/10.0.40219.1/microsoft.reportviewer.common.10.0.40219.1.nupkg
  GET https://api.nuget.org/v3-flatcontainer/microsoft.reportviewer.webforms/10.0.40219.1/microsoft.reportviewer.webforms.10.0.40219.1.nupkg
  GET https://api.nuget.org/v3-flatcontainer/netstandard.library/2.0.0/netstandard.library.2.0.0.nupkg
  GET https://api.nuget.org/v3-flatcontainer/system.buffers/4.5.1/system.buffers.4.5.1.nupkg
  GET https://api.nuget.org/v3-flatcontainer/system.diagnostics.diagnosticsource/4.6.0/system.diagnostics.diagnosticsource.4.6.0.nupkg
  GET https://api.nuget.org/v3-flatcontainer/system.memory/4.5.4/system.memory.4.5.4.nupkg
  GET https://api.nuget.org/v3-flatcontainer/azure.security.keyvault.keys/4.2.0-beta.6/azure.security.keyvault.keys.4.2.0-beta.6.nupkg
  OK https://api.nuget.org/v3-flatcontainer/azure.security.keyvault.secrets/4.2.0-beta.5/azure.security.keyvault.secrets.4.2.0-beta.5.nupkg 13ms
Acquiring lock for the installation of Azure.Security.keyvault.Secrets 4.2.0-beta.5
Acquired lock for the installation of Azure.Security.keyvault.Secrets 4.2.0-beta.5
Installing Azure.Security.keyvault.Secrets 4.2.0-beta.5.
  OK https://api.nuget.org/v3-flatcontainer/epplus/5.6.3/epplus.5.6.3.nupkg 55ms
  OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/1.1.0/microsoft.netcore.platforms.1.1.0.nupkg 52ms
Acquiring lock for the installation of Microsoft.NETCore.Platforms 1.1.0
Acquiring lock for the installation of EPPlus 5.6.3
Acquired lock for the installation of EPPlus 5.6.3
Installing EPPlus 5.6.3.
  OK https://api.nuget.org/v3-flatcontainer/microsoft.bcl.asyncinterfaces/1.0.0/microsoft.bcl.asyncinterfaces.1.0.0.nupkg 54ms
Acquiring lock for the installation of Microsoft.Bcl.AsyncInterfaces 1.0.0
  OK https://api.nuget.org/v3-flatcontainer/system.memory/4.5.4/system.memory.4.5.4.nupkg 53ms
Acquiring lock for the installation of system.memory 4.5.4
Acquired lock for the installation of Microsoft.NETCore.Platforms 1.1.0
Installing Microsoft.NETCore.Platforms 1.1.0.
Acquired lock for the installation of system.memory 4.5.4
Installing system.memory 4.5.4.
  OK https://api.nuget.org/v3-flatcontainer/microsoft.io.recyclablememorystream/1.4.1/microsoft.io.recyclablememorystream.1.4.1.nupkg 55ms
Acquiring lock for the installation of Microsoft.IO.RecyclableMemoryStream 1.4.1
  OK https://api.nuget.org/v3-flatcontainer/azure.identity/1.5.0-beta.1/azure.identity.1.5.0-beta.1.nupkg 59ms
Acquiring lock for the installation of Azure.Identity 1.5.0-beta.1
Acquired lock for the installation of Microsoft.IO.RecyclableMemoryStream 1.4.1
Installing Microsoft.IO.RecyclableMemoryStream 1.4.1.
  OK https://api.nuget.org/v3-flatcontainer/microsoft.identity.client.extensions.msal/2.18.4/microsoft.identity.client.extensions.msal.2.18.4.nupkg 56ms
Acquiring lock for the installation of Microsoft.Identity.Client.Extensions.Msal 2.18.4
Acquired lock for the installation of Microsoft.Bcl.AsyncInterfaces 1.0.0
Installing Microsoft.Bcl.AsyncInterfaces 1.0.0.
Acquired lock for the installation of Azure.Identity 1.5.0-beta.1
Installing Azure.Identity 1.5.0-beta.1.
Acquired lock for the installation of Microsoft.Identity.Client.Extensions.Msal 2.18.4
Installing Microsoft.Identity.Client.Extensions.Msal 2.18.4.
  OK https://api.nuget.org/v3-flatcontainer/azure.core/1.15.0/azure.core.1.15.0.nupkg 59ms
Acquiring lock for the installation of Azure.Core 1.15.0
Acquired lock for the installation of Azure.Core 1.15.0
Installing Azure.Core 1.15.0.
  OK https://api.nuget.org/v3-flatcontainer/azure.security.keyvault.keys/4.2.0-beta.6/azure.security.keyvault.keys.4.2.0-beta.6.nupkg 67ms
Acquiring lock for the installation of Azure.Security.keyvault.Keys 4.2.0-beta.6
Acquired lock for the installation of Azure.Security.keyvault.Keys 4.2.0-beta.6
Installing Azure.Security.keyvault.Keys 4.2.0-beta.6.
  OK https://api.nuget.org/v3-flatcontainer/microsoft.reportviewer.webforms/10.0.40219.1/microsoft.reportviewer.webforms.10.0.40219.1.nupkg 76ms
Acquiring lock for the installation of Microsoft.ReportViewer.WebForms 10.0.40219.1
Acquired lock for the installation of Microsoft.ReportViewer.WebForms 10.0.40219.1
Installing Microsoft.ReportViewer.WebForms 10.0.40219.1.
  OK https://api.nuget.org/v3-flatcontainer/netstandard.library/2.0.0/netstandard.library.2.0.0.nupkg 89ms
Acquiring lock for the installation of NETStandard.Library 2.0.0
Acquired lock for the installation of NETStandard.Library 2.0.0
Installing NETStandard.Library 2.0.0.
  OK https://api.nuget.org/v3-flatcontainer/microsoft.reportviewer.common/10.0.40219.1/microsoft.reportviewer.common.10.0.40219.1.nupkg 99ms
Acquiring lock for the installation of Microsoft.ReportViewer.Common 10.0.40219.1
Acquired lock for the installation of Microsoft.ReportViewer.Common 10.0.40219.1
Installing Microsoft.ReportViewer.Common 10.0.40219.1.
  OK https://api.nuget.org/v3-flatcontainer/system.buffers/4.5.1/system.buffers.4.5.1.nupkg 113ms
Acquiring lock for the installation of System.Buffers 4.5.1
  OK https://api.nuget.org/v3-flatcontainer/system.diagnostics.diagnosticsource/4.6.0/system.diagnostics.diagnosticsource.4.6.0.nupkg 120ms
Acquiring lock for the installation of System.Diagnostics.DiagnosticSource 4.6.0
Acquired lock for the installation of System.Buffers 4.5.1
Installing System.Buffers 4.5.1.
Acquired lock for the installation of System.Diagnostics.DiagnosticSource 4.6.0
Installing System.Diagnostics.DiagnosticSource 4.6.0.
  OK https://api.nuget.org/v3-flatcontainer/microsoft.identity.client/4.30.1/microsoft.identity.client.4.30.1.nupkg 2052ms
Acquiring lock for the installation of Microsoft.Identity.Client 4.30.1
Acquired lock for the installation of Microsoft.Identity.Client 4.30.1
Installing Microsoft.Identity.Client 4.30.1.
Completed installation of Microsoft.NETCore.Platforms 1.1.0
Adding package 'Microsoft.NETCore.Platforms.1.1.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.NETCore.Platforms.1.1.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.NETCore.Platforms.1.1.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Restoring NuGet package system.memory.Data.1.0.2.
  GET https://api.nuget.org/v3-flatcontainer/system.memory.data/1.0.2/system.memory.data.1.0.2.nupkg
Completed installation of Azure.Security.keyvault.Secrets 4.2.0-beta.5
Completed installation of Azure.Security.keyvault.Keys 4.2.0-beta.6
  OK https://api.nuget.org/v3-flatcontainer/system.memory.data/1.0.2/system.memory.data.1.0.2.nupkg 8ms
Acquiring lock for the installation of system.memory.Data 1.0.2
Adding package 'Azure.Security.keyvault.Secrets.4.2.0-beta.5' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Security.keyvault.Secrets.4.2.0-beta.5' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Security.keyvault.Secrets.4.2.0-beta.5' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Restoring NuGet package System.Numerics.Vectors.4.5.0.
Acquired lock for the installation of system.memory.Data 1.0.2
Installing system.memory.Data 1.0.2.
  GET https://api.nuget.org/v3-flatcontainer/system.numerics.vectors/4.5.0/system.numerics.vectors.4.5.0.nupkg
Adding package 'Azure.Security.keyvault.Keys.4.2.0-beta.6' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Security.keyvault.Keys.4.2.0-beta.6' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Security.keyvault.Keys.4.2.0-beta.6' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Restoring NuGet package System.Runtime.CompilerServices.Unsafe.4.6.0.
  GET https://api.nuget.org/v3-flatcontainer/system.runtime.compilerservices.unsafe/4.6.0/system.runtime.compilerservices.unsafe.4.6.0.nupkg
Completed installation of Microsoft.Identity.Client.Extensions.Msal 2.18.4
Adding package 'Microsoft.Identity.Client.Extensions.Msal.2.18.4' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.Identity.Client.Extensions.Msal.2.18.4' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.Identity.Client.Extensions.Msal.2.18.4' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Restoring NuGet package System.Security.Cryptography.ProtectedData.4.5.0.
  GET https://api.nuget.org/v3-flatcontainer/system.security.cryptography.protecteddata/4.5.0/system.security.cryptography.protecteddata.4.5.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/system.security.cryptography.protecteddata/4.5.0/system.security.cryptography.protecteddata.4.5.0.nupkg 7ms
Acquiring lock for the installation of System.Security.Cryptography.ProtectedData 4.5.0
Acquired lock for the installation of System.Security.Cryptography.ProtectedData 4.5.0
Installing System.Security.Cryptography.ProtectedData 4.5.0.
Completed installation of Azure.Identity 1.5.0-beta.1
Adding package 'Azure.Identity.1.5.0-beta.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Identity.1.5.0-beta.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Identity.1.5.0-beta.1' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Restoring NuGet package System.Text.Encodings.Web.4.7.2.
  GET https://api.nuget.org/v3-flatcontainer/system.text.encodings.web/4.7.2/system.text.encodings.web.4.7.2.nupkg
Completed installation of Microsoft.Bcl.AsyncInterfaces 1.0.0
Adding package 'Microsoft.Bcl.AsyncInterfaces.1.0.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.Bcl.AsyncInterfaces.1.0.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.Bcl.AsyncInterfaces.1.0.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Restoring NuGet package System.Text.Json.4.6.0.
  GET https://api.nuget.org/v3-flatcontainer/system.text.json/4.6.0/system.text.json.4.6.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/system.numerics.vectors/4.5.0/system.numerics.vectors.4.5.0.nupkg 811ms
  OK https://api.nuget.org/v3-flatcontainer/system.text.encodings.web/4.7.2/system.text.encodings.web.4.7.2.nupkg 677ms
Acquiring lock for the installation of System.Text.Encodings.Web 4.7.2
Acquiring lock for the installation of System.Numerics.Vectors 4.5.0
  OK https://api.nuget.org/v3-flatcontainer/system.runtime.compilerservices.unsafe/4.6.0/system.runtime.compilerservices.unsafe.4.6.0.nupkg 807ms
Acquiring lock for the installation of System.Runtime.CompilerServices.Unsafe 4.6.0
  OK https://api.nuget.org/v3-flatcontainer/system.text.json/4.6.0/system.text.json.4.6.0.nupkg 670ms
Acquiring lock for the installation of System.Text.Json 4.6.0
Acquired lock for the installation of System.Text.Encodings.Web 4.7.2
Installing System.Text.Encodings.Web 4.7.2.
Acquired lock for the installation of System.Numerics.Vectors 4.5.0
Installing System.Numerics.Vectors 4.5.0.
Acquired lock for the installation of System.Text.Json 4.6.0
Installing System.Text.Json 4.6.0.
Acquired lock for the installation of System.Runtime.CompilerServices.Unsafe 4.6.0
Installing System.Runtime.CompilerServices.Unsafe 4.6.0.

  OK https://api.nuget.org/v3-flatcontainer/system.threading.tasks.extensions/4.5.2/system.threading.tasks.extensions.4.5.2.nupkg 9ms
Acquiring lock for the installation of System.Threading.Tasks.Extensions 4.5.2
Completed installation of Microsoft.IO.RecyclableMemoryStream 1.4.1
Completed installation of system.memory 4.5.4

Completed installation of Azure.Core 1.15.0
Adding package 'Azure.Core.1.15.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Core.1.15.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Azure.Core.1.15.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of System.Diagnostics.DiagnosticSource 4.6.0
Adding package 'System.Diagnostics.DiagnosticSource.4.6.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Diagnostics.DiagnosticSource.4.6.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Diagnostics.DiagnosticSource.4.6.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of System.Runtime.CompilerServices.Unsafe 4.6.0
Adding package 'System.Runtime.CompilerServices.Unsafe.4.6.0' to folder 'D:\a\1\s\LabCode\packages'
Completed installation of System.Text.Encodings.Web 4.7.2
Adding package 'System.Text.Encodings.Web.4.7.2' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Runtime.CompilerServices.Unsafe.4.6.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Runtime.CompilerServices.Unsafe.4.6.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Added package 'System.Text.Encodings.Web.4.7.2' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Text.Encodings.Web.4.7.2' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of System.Threading.Tasks.Extensions 4.5.2
Adding package 'System.Threading.Tasks.Extensions.4.5.2' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Threading.Tasks.Extensions.4.5.2' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Threading.Tasks.Extensions.4.5.2' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of System.Text.Json 4.6.0
Adding package 'System.Text.Json.4.6.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Text.Json.4.6.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Text.Json.4.6.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of System.Security.Cryptography.ProtectedData 4.5.0
Completed installation of Microsoft.ReportViewer.WebForms 10.0.40219.1
Adding package 'System.Security.Cryptography.ProtectedData.4.5.0' to folder 'D:\a\1\s\LabCode\packages'
Adding package 'Microsoft.ReportViewer.WebForms.10.0.40219.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.ReportViewer.WebForms.10.0.40219.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.ReportViewer.WebForms.10.0.40219.1' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Added package 'System.Security.Cryptography.ProtectedData.4.5.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Security.Cryptography.ProtectedData.4.5.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of System.ValueTuple 4.5.0
Adding package 'System.ValueTuple.4.5.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.ValueTuple.4.5.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.ValueTuple.4.5.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of System.Numerics.Vectors 4.5.0
Adding package 'System.Numerics.Vectors.4.5.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Numerics.Vectors.4.5.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'System.Numerics.Vectors.4.5.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of Microsoft.ReportViewer.Common 10.0.40219.1
Adding package 'Microsoft.ReportViewer.Common.10.0.40219.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.ReportViewer.Common.10.0.40219.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.ReportViewer.Common.10.0.40219.1' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of NETStandard.Library 2.0.0
Adding package 'NETStandard.Library.2.0.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'NETStandard.Library.2.0.0' to folder 'D:\a\1\s\LabCode\packages'
Added package 'NETStandard.Library.2.0.0' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of Microsoft.Identity.Client 4.30.1
Adding package 'Microsoft.Identity.Client.4.30.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.Identity.Client.4.30.1' to folder 'D:\a\1\s\LabCode\packages'
Added package 'Microsoft.Identity.Client.4.30.1' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'
Completed installation of EPPlus 5.6.3
Adding package 'EPPlus.5.6.3' to folder 'D:\a\1\s\LabCode\packages'
Added package 'EPPlus.5.6.3' to folder 'D:\a\1\s\LabCode\packages'
Added package 'EPPlus.5.6.3' to folder 'D:\a\1\s\LabCode\packages' from source 'https://api.nuget.org/v3/index.json'

NuGet Config files used:
    D:\a\1\Nuget\tempNuGet_108.config

Feeds used:
    https://api.nuget.org/v3/index.json

Installed:
    24 package(s) to packages.config projects
Finishing: NuGet restore

所有 nuGet 包正在恢复到 d:\a\1\s\LabCode\packages 文件

然后当 msbuild 运行时,它会给出以下错误输出

##[section]Starting: Build solution
==============================================================================
Task         : Visual Studio build
Description  : Build with MSBuild and set the Visual Studio version property
Version      : 1.187.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
==============================================================================
##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" "D:\a\1\s\LabCode.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.187.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.distributedTask.MSBuild.Logger.dll";"RootDetailId=bd1b54f4-cf00-4079-a811-339152db6b3e|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.187.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.distributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="D:\a\1\a\\" /p:platform="any cpu" /p:configuration="debug" /p:VisualStudioVersion="15.0" /p:_MSDeployUserAgent="VSTS_811f008f-007e-4c35-a27e-d88722b3949b_build_8_0"
Building the projects in this solution one at a time. To enable parallel build,please add the "/m" switch.
Build started 6/14/2021 3:03:22 PM.
Project "D:\a\1\s\LabCode.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "debug|any cpu".
##[warning]D:\a\1\s\LabCode.Metaproj(0,0): Warning MSB3030: Could not copy the file "D:\a\1\s\packages\EPPlus.5.6.3\lib\net40\EPPlus.dll" because it was not found.
Project "D:\a\1\s\LabCode.sln" (1) is building "D:\a\1\s\LabCode.Metaproj" (2) on node 1 (default targets).
D:\a\1\s\LabCode.Metaproj : warning MSB3030: Could not copy the file "D:\a\1\s\packages\EPPlus.5.6.3\lib\net40\EPPlus.dll" because it was not found.
  The prevIoUs error was converted to a warning because the task was called with ContinueOnError=true.
  Build continuing because "ContinueOnError" on the task "copy" is set to "true".
  
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /localhost_59094 -p LabCode\ -u -f -d precompiledWeb\localhost_59094\ 
##[error]LabCode\App_Code\Util.cs(6,0): Error CS0246: The type or namespace name 'Azure' Could not be found (are you missing a using directive or an assembly reference?)
d:\a\1\s\LabCode\App_Code\Util.cs(6): error CS0246: The type or namespace name 'Azure' Could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\LabCode.Metaproj]
##[error]LabCode\App_Code\Util.cs(7,0): Error CS0246: The type or namespace name 'Azure' Could not be found (are you missing a using directive or an assembly reference?)
d:\a\1\s\LabCode\App_Code\Util.cs(7): error CS0246: The type or namespace name 'Azure' Could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\LabCode.Metaproj]
Done Building Project "D:\a\1\s\LabCode.Metaproj" (default targets) -- Failed.
Done Building Project "D:\a\1\s\LabCode.sln" (default targets) -- Failed.

Build Failed.

"D:\a\1\s\LabCode.sln" (default target) (1) ->
"D:\a\1\s\LabCode.Metaproj" (default target) (2) ->
(Build target) -> 
  D:\a\1\s\LabCode.Metaproj : warning MSB3030: Could not copy the file "D:\a\1\s\packages\EPPlus.5.6.3\lib\net40\EPPlus.dll" because it was not found.


"D:\a\1\s\LabCode.sln" (default target) (1) ->
"D:\a\1\s\LabCode.Metaproj" (default target) (2) ->
(Build target) -> 
  d:\a\1\s\LabCode\App_Code\Util.cs(6): error CS0246: The type or namespace name 'Azure' Could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\LabCode.Metaproj]
  d:\a\1\s\LabCode\App_Code\Util.cs(7): error CS0246: The type or namespace name 'Azure' Could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\LabCode.Metaproj]

    1 Warning(s)
    2 Error(s)

Time Elapsed 00:00:19.77
##[error]Process 'msbuild.exe' exited with code '1'.
##[section]Finishing: Build solution

因此,即使 NuGet 任务成功完成并恢复了 Azure 包,它也无法找到它们(无法找到 EPPlus,然后它会给出有关 Azure 缺少引用的错误

解决方法

nuget.exe 版本4.4.1太旧,在恢复过程中难免会出现一些不清楚的问题。

我建议您可以尝试使用最新的 nuget 版本 5.9.1 来恢复 nuget 包。另外,不要忘记不要使用本地 nuget 缓存。

像这样:

enter image description here

5.x 表示最新的 nuget.exe 版本。

enter image description here

并选中此选项。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。