0
votes

I have set up a website on Azure to deploy through a TFS repository. The process fails when it tries to install nuget packages which are stored on myGet nuget server, not nuget.org. I have added(and checked into TFS) a nuget.config file in the same folder as my solution file as per this link.

What am I missing so that Azure can restore these packages?

nuget.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <activePackageSource>
  <add key="All" value="(Aggregate source)" />
</activePackageSource>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Syncfusion ASP.NET Core NuGet Package feed URL" value="http://nuget.syncfusion.com/nuget_aspnetcore/nuget/getsyncfusionpackages/aspnetcore" />
    <add key="MyGet" value="https://www.myget.org/F/aspnet-contrib/api/v3/index.json" />
  </packageSources>
<disabledPackageSources />
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

Error in TFS build:

 NuGet Config files used:
             D:\a\3\Nuget\tempNuGet_59.config

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

         Installed:
             100 package(s) to D:\a\3\s\Scrubber\Scrubber.csproj
             132 package(s) to D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj
             9 package(s) to D:\a\3\s\SimplerProducts.MicrosoftEntityFrameworkCoreStorage\SimplerProducts.MicrosoftEntityFrameworkCoreStorage.csproj
       Done executing task "RestoreTask" -- FAILED.
     1>Done building target "Restore" in project "Scrubber.UnitTest.csproj" -- FAILED.
     1>Done Building Project "D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj" (Restore target(s)) -- FAILED.

Build FAILED.

       "D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj" (Restore target) (1) ->
       (Restore target) -> 
         D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.Instagram with version (>= 2.1.0) [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
       D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102:   - Found 11 version(s) in nuget.org [ Nearest version: 2.0.1 ] [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
         D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.Reddit with version (>= 2.1.0) [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
       D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102:   - Found 13 version(s) in nuget.org [ Nearest version: 2.0.1 ] [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
         D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.GitHub with version (>= 2.1.0) [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
       D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102:   - Found 14 version(s) in nuget.org [ Nearest version: 2.0.1 ] [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
         D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.LinkedIn with version (>= 2.1.0) [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
       D:\a\3\s\Scrubber\Scrubber.csproj : error NU1102:   - Found 14 version(s) in nuget.org [ Nearest version: 2.0.1 ] [D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj]
         D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.Instagram with version (>= 2.1.0)
       D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102:   - Found 11 version(s) in nuget.org [ Nearest version: 2.0.1 ]
         D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.Reddit with version (>= 2.1.0)
       D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102:   - Found 13 version(s) in nuget.org [ Nearest version: 2.0.1 ]
         D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.GitHub with version (>= 2.1.0)
       D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102:   - Found 14 version(s) in nuget.org [ Nearest version: 2.0.1 ]
         D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102: Unable to find package AspNet.Security.OAuth.LinkedIn with version (>= 2.1.0)
       D:\a\3\s\Scrubber.UnitTest\Scrubber.UnitTest.csproj : error NU1102:   - Found 14 version(s) in nuget.org [ Nearest version: 2.0.1 ]

    0 Warning(s)
    8 Error(s)
1
what error do you get when restoring?zivkan
It is not able to detect the other package manager locations in the nuget.config file. Perhaps the nuget.config file Is not getting deployed.Ajit Goel
At "normal" verbosity, NuGet outputs all the nuget.config files it found, and all package sources it used. Check the output to make sure it found your nuget.config and lists your package sources. You can download nuget.exe from nuget.org/downloads and run nuget restore whatever.sln from the command line to check locally, which is quicker than triggering a new build on the CI server each time you want to test.zivkan
This issue was resolved as the new library versions were deployed to Nuget(and therefore TFS build did not need to contact the MyGet package manager). In the logs, I see no evidence if TFS was using my nuget.config file or not.Ajit Goel
@AjitGoel, Thanks for sharing your workaround here, you can convert it to the answer, so it could help other community members who get the same issues. According to the log for get source, you may find the info copy the nuget.config file to the tempNuGet_59.config file. And the log shows the Feeds used: only the nuget.org, so it should not use your MyGet feed.Leo Liu-MSFT

1 Answers

1
votes

Deploying to Azure Web Site using multiple package servers

Have you add a service connection to MyGet on your Azure Devops account? If not, you can try to add a service connection to MyGet.

Then select Basic Authentication as authentication method:

enter image description here

And use that credentials when you use restore the nuget package on pipeline:

enter image description here

Check the document Visual Studio Team Services Integration for some more details.

Hope this helps