This is a migrated thread and some comments may be shown as answers.

Azure Devops Nuget Restore failing

3 Answers 3338 Views
Miscellaneous
This is a migrated thread and some comments may be shown as answers.
Marnic
Top achievements
Rank 1
Marnic asked on 02 Mar 2021, 12:46 PM

I have followed the online guide to enable package restore in Azure devops.
https://www.telerik.com/blogs/azure-devops-and-telerik-nuget-packages

But I keep getting errors like this one
https://nuget.telerik.com/nuget/: Package 'Telerik.Windows.Documents.for.Wpf.2020.3.1020' is not found on source '

How can I get this to work? I'm trying to build a WPF application with a standard pipeline but I'm having problems with this Nuget restore step.

 
Bertus
Top achievements
Rank 1
commented on 28 Jul 2021, 06:16 AM

I tried to follow the same guide.
I'm running into issues trying to get this working. I've forked the GitHub repo and setup the service connection in Azure DevOps, the pipline keeps failing at the NuGet restore task. " Response status code does not indicate success: 401 (Unauthorized)" I tried with two different accounts since the organisation account ends in & which I understand can cause issues. The other a trail license with a simple password.
Lance | Manager Technical Support
Telerik team
commented on 28 Jul 2021, 02:03 PM

Hi Bertus, I took a quick look at your account and it doesn't have any licenses (trial or dev), please make sure the correct Telerik account is being used.

You mentioned that you forked the entire repo. Please keep in mind that I have written almost a dozen different projects and approaches in that solution. You may be getting an error for another project, or that specific project is not using the nuget.config.

In any case, you can always just add a cusotm powershell command before any package restore steps.

 

here is the text of the command (the variables are secrets):

dotnet nuget update source Telerik --source https://nuget.telerik.com/nuget --username '$(MyTelerikEmail)' --password '$(MyTelerikPassword)' --store-password-in-clear-text --configfile src/nuget.config

Bertus
Top achievements
Rank 1
commented on 29 Jul 2021, 11:39 AM

Hi Lance,

Thanks for the feedback. I figured the issue with my service connection. It seems passwords with characters that needs URL encoding is problematic, as you mentioned somewhere. I was able to build your console project after making a few small changes to the nuget.config.

Thanks for your response.
Lance | Manager Technical Support
Telerik team
commented on 29 Jul 2021, 01:59 PM

Indeed, there are some characters that can get mangled! My trick for this is to pre-encode them, see my "Handling Special Characters in Password" section at the bottom of this documentation for my recommended technique => Telerik NuGet Server | Telerik UI for Xamarin. Good luck!

3 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 02 Mar 2021, 03:04 PM

Hi Marnic,

Thank you for sharing the details of the error. I can share three main pieces of information you ca n use to fix the issue.

1. Make sure you are using the correct account for the pipeline's Service Connection

this Telerik account does not have a license, therefore it will fail when trying to restore packages. Make sure that you are using an account that has a valid license in the pipeline (your company has 3 licenses, none are assigned to you).

If you still have trouble, ask one of the license holders to open a Technical Support ticket and I will be happy to dig into the account details with them privately.

2. Use a valid server URL

In the error message, I see a trailing slash on the URL. I don't know if this is something that was added to the output, but I must warn you regardless. NuGet servers cannot automatically strip a trailing slash, so it gets treats as a route and the search fails.

Correct

https://nuget.telerik.com/nuget

Incorrect

https://nuget.telerik.com/nuget/

 

3. Incorrect Package name

The last item is what I believe is causing your error. The name of the NuGet package is incorrect, it should be just Telerik.Windows.Documents.for.Wpf

When using a NuGet server, the version number is not in the package's name.

Correct

Telerik.Windows.Documents.for.Wpf

Incorrect (for server feeds)

Telerik.Windows.Documents.for.Wpf.2020.3.1020 


Long Term Solution

The reason you have a version number at the end of the package name is probably because the project was using a local offline package source.

I recommend switching to a server-based package source. Follow these steps

  1. Please open your solution/project folder and look for a nuget.config file.
  2. If you see a local folder path as a package source, delete it (See "Old" below)
  3. Add a new package source pointing to the Telerik server (see "New" below)

My blog post that you linked to has a complete example of a working nuget.config

Old

Remove the local package source folder (highlighted)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Telerik UI for WPF 2021.1.223" value="C:\Program Files (x86)\Progress\Telerik UI for WPF R1 2021\Binaries\NetCore\NuGet" />
  </packageSources>
</configuration>

New

Add the Telerik NuGet server as a package source instead

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
        <add key="TelerikFeed" value="https://nuget.telerik.com/nuget" />
  </packageSources>
</configuration>

Confirming or Updating Package References

Finally, make sure your projects are using the correctly named packages. You can do this very quickly by opening the WPF project's .csproj file and reviewing the PackageReferences


Regards,
Lance | Manager Technical Support
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Marnic
Top achievements
Rank 1
answered on 15 Mar 2021, 10:46 AM

Thanks for the assistance. We have not yet moved our nuget packages into "PackageReference". We are still using the packages.config file.

The migration process is giving us some unexpected issues so we are postponing that a bit. Is this move a prerequisite to get the build to work? Or can I accomplish the same result with the pacackages.config reference?

0
Lance | Manager Technical Support
Telerik team
answered on 15 Mar 2021, 01:54 PM

Hi,

In your case, it's irrelevant because you're still using nuget.exe instead of .NET 5's 'dotnet restore' command.

Just make sure you're setting up your nuget restore command correctly (i.e. nuget.config and credentials, see screenshots). I also recommend making sure you're on at least nuget.exe v4.8 or higher

Did you take a moment to review the source code of the demos in my blog post? If not, please carefully review it  here https://github.com/LanceMcCarthy/DevOpsExamples/tree/main/src  (the WPF app uses a packages.config)

For your convenience, here are a couple screenshot of the WPF app's pipeline:

Regards,
Lance | Manager Technical Support
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Miscellaneous
Asked by
Marnic
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Marnic
Top achievements
Rank 1
Share this question
or