0

I have set up an Azure Static website, and use an AzureDevOps pipeline to push my Blazor application into it, however, I'm using some NuGet packages from a private feed, and even though I do a restore with that feed id on the build, it still says it can't find the NuGet packages belonging to that feed. For some reason it's only looking at the NuGet official feed, and not my private feed.

Here is my build pipeline:

My build pipeline

Here is my log on the build:

Build log

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\1vd04tff.vjr.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\cyz5rg4y.zhy.nugetrestore.targets" /p:RestoreUseCustomAfterTargets="True" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet\5.8.0\x64\nuget.exe" /p:RestoreSolutionDirectory="D:\a\1\s\" /p:RestoreConfigFile="D:\a\1\Nuget\tempNuGet_93.config" /p:SolutionDir="D:\a\1\s\" /p:SolutionName="Shield.Eagle.UI" NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown. at NuGet.CommandLine.MsBuildUtility.d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.CommandLine.RestoreCommand.d__68.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.CommandLine.RestoreCommand.d__63.MoveNext() ##[error]The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk\5.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0. [D:\a\1\s\src\Shield.Eagle.UI\Shield.Eagle.UI.csproj] C:\Program Files\dotnet\sdk\5.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0. [D:\a\1\s\src\Shield.Eagle.Components\Shield.Eagle.Components.csproj]) ##[error]Packages failed to restore

Lex
  • 879
  • 3
  • 16
  • 27
  • How about the issue? Does the answer below resolved your question, If not, would you please let me know the latest information about this issue? – Leo Liu Aug 17 '21 at 02:19
  • Kinda, I made some changes to the pipelines, and then the actual error came up, and that was related to the fact that it was unable to restore .net 6 packages in private feeds. – Lex Aug 18 '21 at 08:40
  • So, have you resolved your question? If not, would you mind share the build log for the task nuget restore? – Leo Liu Aug 19 '21 at 02:53
  • I've added the bit that indicated the .net 6 not working attached to it. Interestingly enough, I had the same issue with a dotnet 6 API that I tried to publish. It too was complaining about the NuGet sources, when I tried to publish that from Visual Studio – Lex Aug 21 '21 at 14:42

1 Answers1

0

AzureDevops static website not finding NuGet packages from private feed

You could try to add the NuGet authenticate task before nuget restore task:

- task: NuGetAuthenticate@0
  displayName: 'NuGet Authenticate'
  inputs:
    nuGetServiceConnections: MyCustomNuGet

If this not help you, please share your nuget restore task build log in the question and one name of your private package, so that we could check it in the build log.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135