Installing Nuget packages form repository in VSTS - azure-devops

I have certain packages that are not available online. I am maintaining a package folder in my repo that holds all the packages required for the application to successfully build.
I am trying to figure out a way to install packages in VSTS build definition from the packages present in repo.
Thanks in advance.

I recommend that you can store your packages in VSTS package feed. Then restore the packages from your VSTS feed.
Publish your packages to your VSTS package feed. (Refer to Package Management in Team Services and TFS)
Edit your build definition, specify config file for Nuget restore step or put NuGet.config at the solution root, next to the project.json file.
Regarding packages store in the repository scenario, you can clone that repository to the corresponding folder by using Command Line step/task;
Edit your build definition
Select Options
Check Allow Scripts to Access OAuth Token
Add Command Line step (Tool: [git tool path] (you can add nuget.exe to environment (system) variable), Arguments: clone https://:$(System.AccessToken)#[git repo url], Working folder: [folder that packages need to download]
On the other hand, if the project/solution file and package files are in the same repository, you just need to select corresponding repository in Repository tab of build definition.

Related

Is there Telerik UI for UWP nuget for UNO?

https://github.com/unoplatform/Uno.Telerik.UI-For-UWP is there a nuget for this repo?
I couldn't find any on nuget and Telerik.UI.for.UniversalWindowsPlatform is not support on mobile projects. Thanks.
[Update 2]
I am no longer continuing development on this and instead focusing my efforts on Telerik UI for MAUI.
[Update]
I am working on making this available for the Uno community. You can find it on nuget.org at xxx
[Original]
Telerik doesn't own that fork, so they do not publish a NuGet package for it.
If you would like to have a NuGet package, you can clone the repo locally and compile it yourself. See the Getting Started section of the README to lean how to compile the repository.
Generate NuGet Package
Once it is compiled, you can generate a .nupkg file (see number 6):
Make sure you have the required software to build UWP applications
Clone a copy of the repository code
Open UWPControls.sln located in Controls folder and build it
Open UWPMap.sln located in Controls folder and build it in x86/x64 and ARM configs
All binaries are now located in Binaries folder
You can additionally build a NuGet package by running BuildTools/BuildNuGet.bat. The generated package will be located in the NuGet subfolder.
Next Steps
Once you have your own nupkg file, you can put it in a Package Source (i.e. just a local folder) or put it in your own nuget feed server and list that as a packages source.

Does nuget push to Azure DevOps artifact include symbols?

I have a class library that I often need to debug/step-into that I distribute and use as a nuget package to Azure DevOps Artifacts feed.
To create the package, I run the following commands using nuget.exe v5.4:
nuget spec
I then enter data in the .nuspec file. Then I run:
nuget pack myLibrary.csproj -Symbols -SymbolPackageFormat snupkg
This generates both the nuget package file and the snupkg symbol file in the current working directory.
I then push this up to our Artifacts feed using the VSTS Credential Provider:
nuget push -Source "MyPackageSource" -ApiKey VSTS myLibrary.nupkg
This general spec, pack, push method works fine.
It was my understanding that pushing the .nupkg file would also push up the .snupkg symbol file with it as long as it's in the same directory as per this documentation:
You can also push both primary and symbol packages at the same time
using the below command. Both .nupkg and .snupkg files need to be
present in the current folder.
nuget push MyPackage.nupkg
However, after installing the package, I am not able to step-into the package code. I also don't see anything new in the package install folder. Just the standard nupkg and the dll. How do I push up the symbols and subsequently get them to install?
You can check your logs to be sure (the log should tell you the snupkg was pushed, just as it does for nupkg files, if it was indeed pushed).
My understanding is that Azure DevOps doesn't support snupkg packages, so I expect that it does not get pushed. However, Azure Pipeline has a built-in "Index Sources & Publish Symbols task" which you can use. Rather than creating a symbols package, just point it directly to your pdbs.

TeamCity cloned build configuration fails with NuGet error

I have created a branch on tfs2012 right next to the folder containing the main solution. Everything is identical.
I also have a working TeamCity build configuration for the main solution. But when I clone the build configuration and change only the source file path in the build step, i get the following error:
The 'System.Net.NameResolution 4.0.0' package requires NuGet client
version '2.12' or above, but the current NuGet version is
'2.8.60717.93'.
NuGet's docs have a page dedicated to nuget.config, which has a large sample at the end.
For tooling support, if you have installed the .NET Core SDK, you can use dotnet new nugetconfig on the command line to create a file from a template. Tooling to modify this file isn't yet in the dotnet cli, so you'll need to download nuget.exe from nuget.org, then you can use commands like "nuget sources add" or "nuget config" to change values, just be sure to use the -ConfigFile paramater, as nuget.exe defaults to your user profile nuget.config, even when there's a nuget.config file in the current directory.
Ultimately it's just an XML file, so I feel like most people just edit it directly using samples online or the nuget.config reference I linked to as a guide.

Command to update packages repo in PackageManager console

I need to update package repo before building a solution in TFS Build Definition. I want to implement this using CommandLine build task.
Could someone tell me how to write a command to update package repo using a path.
According to your prior question, there are just missing some external packages during your TFS build pipeline.
Usually TFS use Package Management that hosts NuGet, npm, and Maven packages alongside all your other TFS assets: source code, builds, releases, etc, also be able to handle the external packages.
You could directly add external packages to a TFS Package Management feed. When you restore the packages, select the feed. All need packages will be restored entirely. To achieve this, just use Push NuGet packages to specify the packages you want to publish and the target feed location.
More details please refer Get started with NuGet Package Management in TFS

Nuget with devops and fallback

Is it possible for a dev team to utlize nuget when the repository is available and fallback to an included assembly folder when the repository is not available?
E.G. Our dev team has access to a nuget repository, so when we update our nuget packages from the repo that is not available to the deployment team, we would want to update the included assemblies with those assemblies...and allow the build/deployment team to fallback to the included assemblies.
You can use a shared folder on your network as a backup repository.
Simply pick a shared folder that everyone, and the build server's user account, has access to.
Then, add a new package source pointing to this folder
Lastly, make sure that whenever you update a nuget package, you drop a copy of it in this backup folder. A simple script could do this for you.