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

Getting azure build pipeline working

1 Answer 1180 Views
Miscellaneous
This is a migrated thread and some comments may be shown as answers.
BitShift
Top achievements
Rank 1
Veteran
BitShift asked on 17 Sep 2020, 07:04 PM

I have started an azure pipeline build (yaml version) and was looking over this example setting up the telerik feed as a service connection.
https://www.telerik.com/blogs/azure-devops-and-telerik-nuget-packages
https://www.youtube.com/watch?time_continue=231&v=rUWU2n6FwgA&feature=emb_title

(1) That was easy enough to get the service connection for the feed, but why do we need a seperate nuget.config file?
Shouldn't Azure be smart enough to pull from nuget.org?

(2) I had put a nuget.config file in my user profile folder on my workstation a while back, after setting up the telerik feed I believe.
Actually, I cant recall if I had to add that file manually, or its created when Visual Studio is installed?
Do I need to use only one of these ?  eg.  the one in the user profile path (%appdata%\roaming\nuget) or the solution root?

(3) In the linked example source, there is a nuget.config in each project folder.  Same question as (1) - why?
https://github.com/LanceMcCarthy/DevOpsExamples/tree/main/src/Wpf

1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 18 Sep 2020, 02:34 PM

Hello Randal,

Let me get right to your answers:

Question 1

It's not Azure we're talking about here, it's the clean machine that is running the build. You need to think in terms of "a brand new VM with preinstalled dev tools". When a build pipeline starts, it looks through all the devOps VMs and finds a VM that is running an "agent" that matches your predefined conditions.

The agent is a little piece of software that downloads the tasks from your pipeline and runs them on that machine. you can have custom agents, which run on your local dev box, but most developer use the agents from Microsoft's Azure Pipelines pool of VMs.

For example, here's the agent for the Blazor Demo:

So, lets get back to your question about whether or not Azure is smart enough to know to use nuget.org. All the default agents have installed, so it has 1 package source by default nuget.org. That is irrelevant because what you really need is the Telerik server to be in the Package sources list during your build.

Therefore, you need to add the Telerik server to the Package Sources on that VM, for that pipeline run (it gets cleaned after your use, unless you are using a custom Agent).

So, when you get to the nuget restore task in your pipeline, you have two option to choose from:

  • "Use nuget.org"
  • "Use feeds in my nuget.config"

Therefore, you use a nuget.config to add the Telerik server to the package sources on that VM

Custom Command Note

You could use a command line to add the package source to the VM instead of a nuget.config, that topic is outside the scope of the tutorial and outside the scope of Telerik support.

If you would rather add a Powershell task to the pipeline instead of using a nuget.config, see the command below. If you would like to learn more about nuget.exe command line, see NuGet Command Line Reference.

nuget add source https://nuget.telerik.com/nuget -n TelerikFeed -u myTelerikUsername -p myTelerikPassword --store-password-in-clear-text

>Important: You must use the --store-password-in-clear-text flag. The value is still a protected string, you are just instructing nuget that the password is not pre-encrypted

Question 2

The nuget.config is not for packages from nuget.org, it is for packages from Telerik server.

Question 3

Nuget.exe looks for the a nuget.config in several different places. My goal for that repository was to have three, completely separate demos that are not entangled with each other. Therefore, each separate example has its own nuget.config.

Yes, in a real-world production project that has multiple projects, you would have a single nuget.config shared with all the projects. again, you would typically have the nuget.config file next to the sln file (which is already at the top of all the projects). 

Take a look at my real-world app that does this https://github.com/LanceMcCarthy/DevReachCompanion/tree/main/src/DevReach2019

 

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/.

Jonathan
Top achievements
Rank 1
commented on 02 Jul 2021, 09:07 PM

Hello, thank you for the explanation, but do you have any help on how to create a nuget.config file.

The Power shell command won't work because my pipeline is running on Ubuntu.
Lance | Senior Manager Technical Support
Telerik team
commented on 02 Jul 2021, 09:30 PM | edited

You can use the nuget.config from my blog post or just copy from the demo repo. If you're asking how to create one, just create a blank named "nuget.config" file and copy those contents into it. For more information see nuget.config File Reference | Microsoft Docs
Jonathan
Top achievements
Rank 1
commented on 03 Jul 2021, 04:30 PM

Thank you for the help.
I was half asleep when trying to get that done.
It seems to be working now.
Tags
Miscellaneous
Asked by
BitShift
Top achievements
Rank 1
Veteran
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or